aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Data/AniList/identity.ts
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-03-01 16:20:51 -0800
committerFuwn <[email protected]>2026-03-01 16:21:02 -0800
commiteae5d24d9e79e59a19d4721caaeaa0ca650ecb33 (patch)
tree1b685bb248e051dfa26d2bfdebe6689402dd93c5 /src/lib/Data/AniList/identity.ts
parentchore(tooling): remove legacy eslint and prettier (diff)
downloaddue.moe-eae5d24d9e79e59a19d4721caaeaa0ca650ecb33.tar.xz
due.moe-eae5d24d9e79e59a19d4721caaeaa0ca650ecb33.zip
chore(biome): drop formatter style overrides
Diffstat (limited to 'src/lib/Data/AniList/identity.ts')
-rw-r--r--src/lib/Data/AniList/identity.ts50
1 files changed, 26 insertions, 24 deletions
diff --git a/src/lib/Data/AniList/identity.ts b/src/lib/Data/AniList/identity.ts
index 23f47a2e..eacc2ae4 100644
--- a/src/lib/Data/AniList/identity.ts
+++ b/src/lib/Data/AniList/identity.ts
@@ -1,34 +1,36 @@
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"],
+ };
};