import { redirect } from '@sveltejs/kit'; import type { Actions } from './$types'; import type { PageServerLoad } from './$types'; import { auth } from '$lib/server/auth'; export const load: PageServerLoad = (event) => { if (!event.locals.user) { throw redirect(302, '/auth/login'); } return { user: event.locals.user }; }; export const actions: Actions = { signOut: async (event) => { await auth.api.signOut({ headers: event.request.headers }); throw redirect(302, '/auth/login'); } };