diff options
Diffstat (limited to 'src/routes/api/preferences')
| -rw-r--r-- | src/routes/api/preferences/+server.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/routes/api/preferences/+server.ts b/src/routes/api/preferences/+server.ts index 0a30274b..0f62fb76 100644 --- a/src/routes/api/preferences/+server.ts +++ b/src/routes/api/preferences/+server.ts @@ -1,5 +1,6 @@ import { userIdentity } from "$lib/Data/AniList/identity"; import { decodeAuthCookieOrThrow } from "$lib/Effect/authCookie"; +import { decodeRequestJsonOrThrow } from "$lib/Effect/requestBody"; import { getUserPreferences, toggleHideMissingBadges, @@ -9,6 +10,7 @@ import { togglePinnedBadgeWallCategory, setPinnedBadgeWallCategories, } from "$lib/Database/SB/User/preferences"; +import { Schema } from "effect"; const unauthorised = new Response("Unauthorised", { status: 401 }); @@ -68,7 +70,12 @@ export const PUT = async ({ url, cookies, request }) => { if (url.searchParams.get("setCategories") !== null) return Response.json( - await setPinnedBadgeWallCategories(userId, await request.json()), + await setPinnedBadgeWallCategories(userId, [ + ...(await decodeRequestJsonOrThrow( + request, + Schema.Array(Schema.String), + )), + ]), { headers: { "Access-Control-Allow-Origin": "https://due.moe", |