diff options
| author | Fuwn <[email protected]> | 2024-02-18 05:35:27 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-02-18 05:35:27 -0800 |
| commit | 1eb42f9d3aa001ff41b3bbee74746efcdaff9e81 (patch) | |
| tree | 41197e053f08646b2cef6298439fce8a143fa513 /src/routes/api/preferences | |
| parent | fix(badges): return empty preferences (diff) | |
| download | due.moe-1eb42f9d3aa001ff41b3bbee74746efcdaff9e81.tar.xz due.moe-1eb42f9d3aa001ff41b3bbee74746efcdaff9e81.zip | |
fix(preferences): add preferences when not set
Diffstat (limited to 'src/routes/api/preferences')
| -rw-r--r-- | src/routes/api/preferences/badges/+server.ts | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/src/routes/api/preferences/badges/+server.ts b/src/routes/api/preferences/badges/+server.ts deleted file mode 100644 index 24d4924b..00000000 --- a/src/routes/api/preferences/badges/+server.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { userIdentity } from '$lib/Data/AniList/identity'; -import { toggleHideMissingBadges } from '$lib/Database/userPreferences'; - -const unauthorised = new Response('Unauthorised', { status: 401 }); - -export const PUT = async ({ cookies }) => { - const userCookie = cookies.get('user'); - - if (!userCookie) return unauthorised; - - const user = JSON.parse(userCookie); - - return Response.json( - await toggleHideMissingBadges( - ( - await userIdentity({ - tokenType: user['token_type'], - expiresIn: user['expires_in'], - accessToken: user['access_token'], - refreshToken: user['refresh_token'] - }) - ).id - ), - { - headers: { - method: 'PUT', - 'Access-Control-Allow-Origin': 'https://due.moe' - } - } - ); -}; |