diff options
| author | Fuwn <[email protected]> | 2024-10-09 00:41:20 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-10-09 00:41:43 -0700 |
| commit | 998b63a35256ac985a5a2714dd1ca451af4dfd8a (patch) | |
| tree | 50796121a9d5ab0330fdc5d7e098bda2860d9726 /src/lib/Data/AniList/identity.ts | |
| parent | feat(graphql): add badgeCount field (diff) | |
| download | due.moe-998b63a35256ac985a5a2714dd1ca451af4dfd8a.tar.xz due.moe-998b63a35256ac985a5a2714dd1ca451af4dfd8a.zip | |
chore(prettier): use spaces instead of tabs
Diffstat (limited to 'src/lib/Data/AniList/identity.ts')
| -rw-r--r-- | src/lib/Data/AniList/identity.ts | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/lib/Data/AniList/identity.ts b/src/lib/Data/AniList/identity.ts index 7214ffa4..23f47a2e 100644 --- a/src/lib/Data/AniList/identity.ts +++ b/src/lib/Data/AniList/identity.ts @@ -1,34 +1,34 @@ export interface UserIdentity { - id: number; - name: string; - avatar: string; + id: number; + name: string; + avatar: string; } export interface AniListAuthorisation { - tokenType: string; - accessToken: string; - expiresIn: number; - refreshToken: string; + tokenType: string; + accessToken: string; + expiresIn: number; + refreshToken: string; } export const userIdentity = async ( - anilistAuthorisation: AniListAuthorisation + anilistAuthorisation: AniListAuthorisation ): Promise<UserIdentity> => { - const userIdResponse = await ( - await fetch('https://graphql.anilist.co', { - method: 'POST', - headers: { - Authorization: `${anilistAuthorisation.tokenType} ${anilistAuthorisation.accessToken}`, - 'Content-Type': 'application/json', - Accept: 'application/json' - }, - body: JSON.stringify({ query: `{ Viewer { id name avatar { large } } }` }) - }) - ).json(); + const userIdResponse = await ( + await fetch('https://graphql.anilist.co', { + method: 'POST', + headers: { + Authorization: `${anilistAuthorisation.tokenType} ${anilistAuthorisation.accessToken}`, + 'Content-Type': 'application/json', + Accept: 'application/json' + }, + body: JSON.stringify({ query: `{ Viewer { id name avatar { large } } }` }) + }) + ).json(); - return { - id: userIdResponse['data']['Viewer']['id'], - name: userIdResponse['data']['Viewer']['name'], - avatar: userIdResponse['data']['Viewer']['avatar']['large'] - }; + return { + id: userIdResponse['data']['Viewer']['id'], + name: userIdResponse['data']['Viewer']['name'], + avatar: userIdResponse['data']['Viewer']['avatar']['large'] + }; }; |