aboutsummaryrefslogtreecommitdiff
path: root/src/routes/api/preferences/pin/+server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/api/preferences/pin/+server.ts')
-rw-r--r--src/routes/api/preferences/pin/+server.ts50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/routes/api/preferences/pin/+server.ts b/src/routes/api/preferences/pin/+server.ts
index 28398cf0..15465113 100644
--- a/src/routes/api/preferences/pin/+server.ts
+++ b/src/routes/api/preferences/pin/+server.ts
@@ -1,32 +1,32 @@
-import { userIdentity } from '$lib/Data/AniList/identity';
-import { toggleHololiveStreamPinning } from '$lib/Database/SB/User/preferences';
+import { userIdentity } from "$lib/Data/AniList/identity";
+import { toggleHololiveStreamPinning } from "$lib/Database/SB/User/preferences";
-const unauthorised = new Response('Unauthorised', { status: 401 });
+const unauthorised = new Response("Unauthorised", { status: 401 });
export const PUT = async ({ cookies, url }) => {
- const userCookie = cookies.get('user');
+ const userCookie = cookies.get("user");
- if (!userCookie) return unauthorised;
+ if (!userCookie) return unauthorised;
- const user = JSON.parse(userCookie);
+ const user = JSON.parse(userCookie);
- return Response.json(
- await toggleHololiveStreamPinning(
- (
- await userIdentity({
- tokenType: user['token_type'],
- expiresIn: user['expires_in'],
- accessToken: user['access_token'],
- refreshToken: user['refresh_token']
- })
- ).id,
- url.searchParams.get('stream') || ''
- ),
- {
- headers: {
- method: 'PUT',
- 'Access-Control-Allow-Origin': 'https://due.moe'
- }
- }
- );
+ return Response.json(
+ await toggleHololiveStreamPinning(
+ (
+ await userIdentity({
+ tokenType: user["token_type"],
+ expiresIn: user["expires_in"],
+ accessToken: user["access_token"],
+ refreshToken: user["refresh_token"],
+ })
+ ).id,
+ url.searchParams.get("stream") || "",
+ ),
+ {
+ headers: {
+ method: "PUT",
+ "Access-Control-Allow-Origin": "https://due.moe",
+ },
+ },
+ );
};