boredgame/src/routes/(auth)/logout/+page.server.ts

13 lines
371 B
TypeScript
Raw Normal View History

import { redirect } from 'sveltekit-flash-message/server';
2024-03-11 06:19:55 +00:00
import type { Actions } from "./$types";
2024-08-15 23:46:58 +00:00
import {StatusCodes} from "$lib/constants/status-codes";
2023-05-21 05:18:04 +00:00
export const actions: Actions = {
default: async (event) => {
2024-08-15 23:46:58 +00:00
const { locals } = event;
console.log('Signing out user');
2024-08-15 23:46:58 +00:00
await locals.api.me.logout.$post()
redirect(StatusCodes.SEE_OTHER, '/login')
2023-05-21 05:18:04 +00:00
}
};