aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Data
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Data')
-rw-r--r--src/lib/Data/AniList/user.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/Data/AniList/user.ts b/src/lib/Data/AniList/user.ts
index 5b9390db..aaab6e0b 100644
--- a/src/lib/Data/AniList/user.ts
+++ b/src/lib/Data/AniList/user.ts
@@ -45,8 +45,8 @@ export interface FullUser {
about: string;
}
-export const user = async (username: string, id = false): Promise<User> =>
- (
+export const user = async (username: string, id = false): Promise<User | null> => {
+ const response = (
await (
await fetch('https://graphql.anilist.co', {
method: 'POST',
@@ -64,11 +64,14 @@ export const user = async (username: string, id = false): Promise<User> =>
count meanScore chaptersRead volumesRead
}
}
- } }`
+ } }`
})
})
).json()
- )['data']['User'];
+ )
+
+ return response["data"]["User"] === null ? null : response["data"]["User"];
+}
export const dumpUser = async (username: string): Promise<FullUser> =>
(