diff options
| author | Fuwn <[email protected]> | 2023-12-14 12:52:26 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-12-14 12:52:26 -0800 |
| commit | c4267cce67e7de6dea2277ce07b6f9a22d8ca674 (patch) | |
| tree | c1279a47204ea7359937b469f61e48deb3c64747 /src/routes/api/anilist-increment | |
| parent | style(stores): simplify statements (diff) | |
| download | due.moe-c4267cce67e7de6dea2277ce07b6f9a22d8ca674.tar.xz due.moe-c4267cce67e7de6dea2277ce07b6f9a22d8ca674.zip | |
feat(api): nest routes
Diffstat (limited to 'src/routes/api/anilist-increment')
| -rw-r--r-- | src/routes/api/anilist-increment/+server.ts | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/src/routes/api/anilist-increment/+server.ts b/src/routes/api/anilist-increment/+server.ts deleted file mode 100644 index 4680236b..00000000 --- a/src/routes/api/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() - ); -}; |