1import { gql } from 'graphql-request'; 2 3import { apiClient } from '../apiClient'; 4 5export type UserData = { 6 id: string; 7 appCount: number; 8 email: string; 9 username: string; 10 profilePhoto: string; 11 accounts: UserAccount[]; 12}; 13 14export type UserAccount = { 15 id: string; 16 name: string; 17 owner: { 18 username: string; 19 fullName?: string; 20 profilePhoto?: string; 21 }; 22}; 23 24const query = gql` 25 { 26 me { 27 id 28 appCount 29 email 30 profilePhoto 31 username 32 33 accounts { 34 id 35 name 36 owner { 37 username 38 fullName 39 profilePhoto 40 } 41 } 42 } 43 } 44`; 45 46export async function getUserProfileAsync() { 47 return apiClient.request(query).then((data) => data.me as UserData); 48} 49