File size: 583 Bytes
64d3841
 
 
e4a770a
64d3841
 
 
e4a770a
 
 
64d3841
 
 
 
 
 
 
767afa7
64d3841
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { dev } from "$app/environment";
import { base } from "$app/paths";
import { COOKIE_NAME } from "$env/static/private";
import { collections } from "$lib/server/database";
import { redirect } from "@sveltejs/kit";

export const actions = {
	default: async function ({ cookies, locals }) {
		await collections.sessions.deleteOne({ sessionId: locals.sessionId });

		cookies.delete(COOKIE_NAME, {
			path: "/",
			// So that it works inside the space's iframe
			sameSite: dev ? "lax" : "none",
			secure: !dev,
			httpOnly: true,
		});
		throw redirect(303, `${base}/`);
	},
};