From d6fe2c594a170553e9b88efc6338456dfd13391c Mon Sep 17 00:00:00 2001 From: Fuwn Date: Wed, 13 Sep 2023 01:46:20 -0700 Subject: refactor(anilist): move to api --- src/routes/anilist/increment/+server.ts | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 src/routes/anilist/increment/+server.ts (limited to 'src/routes/anilist/increment/+server.ts') diff --git a/src/routes/anilist/increment/+server.ts b/src/routes/anilist/increment/+server.ts deleted file mode 100644 index 4680236b..00000000 --- a/src/routes/anilist/increment/+server.ts +++ /dev/null @@ -1,27 +0,0 @@ -export const GET = async ({ url, cookies }) => { - const userCookie = cookies.get('user'); - - if (!userCookie) { - return new Response('Unauthenticated', { status: 401 }); - } - - const user = JSON.parse(userCookie); - - return Response.json( - await ( - await fetch('https://graphql.anilist.co', { - method: 'POST', - headers: { - Authorization: `${user['token_type']} ${user['access_token']}`, - 'Content-Type': 'application/json', - Accept: 'application/json' - }, - body: JSON.stringify({ - query: `mutation { SaveMediaListEntry(mediaId: ${ - url.searchParams.get('id') || 'null' - }, progress: ${url.searchParams.get('progress') || 'null'}) { id } }` - }) - }) - ).json() - ); -}; -- cgit v1.2.3