From 973676e1777ce9c713a5cefe5edf17008f41c17f Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 7 Sep 2023 16:37:30 -0700 Subject: feat(routes): profile page --- src/lib/AniList/activity.ts | 2 +- src/lib/AniList/user.ts | 46 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/lib/AniList/user.ts (limited to 'src/lib') diff --git a/src/lib/AniList/activity.ts b/src/lib/AniList/activity.ts index 9d30d275..0d79bf72 100644 --- a/src/lib/AniList/activity.ts +++ b/src/lib/AniList/activity.ts @@ -17,7 +17,7 @@ export const lastActivityDate = async (userIdentity: UserIdentity): Promise => { + const userData = ( + await ( + await fetch('https://graphql.anilist.co', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json' + }, + body: JSON.stringify({ + query: `{ User(name: "${username}") { + name id statistics { + anime { + count meanScore minutesWatched episodesWatched + } + manga { + count meanScore chaptersRead volumesRead + } + } + } }` + }) + }) + ).json() + )['data']['User']; + + return userData; +}; -- cgit v1.2.3