From e134af3acf93c026be795d54cdd1de75bb628a0d Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 4 Feb 2024 18:47:23 -0800 Subject: feat(user): can use id --- src/lib/AniList/user.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/AniList/user.ts') diff --git a/src/lib/AniList/user.ts b/src/lib/AniList/user.ts index c6b8189a..d2f06354 100644 --- a/src/lib/AniList/user.ts +++ b/src/lib/AniList/user.ts @@ -44,7 +44,7 @@ export interface FullUser { about: string; } -export const user = async (username: string): Promise => +export const user = async (username: string, id = false): Promise => ( await ( await fetch('https://graphql.anilist.co', { @@ -54,7 +54,7 @@ export const user = async (username: string): Promise => Accept: 'application/json' }, body: JSON.stringify({ - query: `{ User(name: "${username}") { + query: `{ User(${id ? `id: ${username}` : `name: "${username}"`}) { name id bannerImage avatar { large } statistics { anime { count meanScore minutesWatched episodesWatched -- cgit v1.2.3