aboutsummaryrefslogtreecommitdiff
path: root/src/routes/api
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-05-04 20:26:49 -0700
committerFuwn <[email protected]>2024-05-04 20:26:49 -0700
commite242c23c10cbfb51bab1a678daef34441f127eda (patch)
tree5194d8a49db17f07d0ba19713a45ab0379ae2cd3 /src/routes/api
parentfeat(badges): pinned categories (diff)
downloaddue.moe-e242c23c10cbfb51bab1a678daef34441f127eda.tar.xz
due.moe-e242c23c10cbfb51bab1a678daef34441f127eda.zip
feat(user): pinned category ui
Diffstat (limited to 'src/routes/api')
-rw-r--r--src/routes/api/preferences/+server.ts13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/routes/api/preferences/+server.ts b/src/routes/api/preferences/+server.ts
index 379f33c5..2fe2ccfe 100644
--- a/src/routes/api/preferences/+server.ts
+++ b/src/routes/api/preferences/+server.ts
@@ -4,7 +4,8 @@ import {
toggleHideMissingBadges,
setCSS,
setBiography,
- toggleHideAWCBadges
+ toggleHideAWCBadges,
+ togglePinnedBadgeWallCategory
} from '$lib/Database/userPreferences';
const unauthorised = new Response('Unauthorised', { status: 401 });
@@ -55,6 +56,16 @@ export const PUT = async ({ url, cookies, request }) => {
}
});
+ if (url.searchParams.get('toggleCategory') !== null)
+ return Response.json(
+ await togglePinnedBadgeWallCategory(userId, url.searchParams.get('toggleCategory') || ''),
+ {
+ headers: {
+ 'Access-Control-Allow-Origin': 'https://due.moe'
+ }
+ }
+ );
+
if (url.searchParams.get('biography') !== null)
return Response.json(await setBiography(userId, (await request.text()).slice(0, 3000)), {
headers: {