mirror of
https://github.com/danbulant/Portfolio
synced 2026-06-19 14:31:05 +00:00
feat: logout endpoint
This commit is contained in:
parent
60e574d2b1
commit
86c1a8a126
1 changed files with 14 additions and 0 deletions
|
|
@ -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');
|
||||
};
|
||||
Loading…
Reference in a new issue