feat: logout endpoint

This commit is contained in:
EETagent 2022-12-04 14:44:39 +01:00
parent 60e574d2b1
commit 86c1a8a126

View file

@ -0,0 +1,14 @@
import type { PageServerLoad } from './$types';
import { redirect } from '@sveltejs/kit';
import { apiLogout } from '$lib/@api/admin';
export const load: PageServerLoad = async ({ fetch, cookies }) => {
const a = await apiLogout(fetch);
console.log(a);
cookies.delete('id', { path: '/' });
cookies.delete('key', { path: '/' });
throw redirect(302, '/admin/auth/login');
};