mirror of
https://github.com/danbulant/Portfolio
synced 2026-06-08 01:00:16 +00:00
feat: ssr fetch logout
This commit is contained in:
parent
dfd746be5a
commit
1226f34a54
1 changed files with 7 additions and 7 deletions
|
|
@ -1,13 +1,13 @@
|
||||||
import type { PageServerLoad } from './$types';
|
import type { PageServerLoad } from './$types';
|
||||||
|
|
||||||
import { redirect } from '@sveltejs/kit';
|
import { redirect } from '@sveltejs/kit';
|
||||||
import { logout } from '$lib/stores/candidate';
|
import { apiLogout } from '$lib/@api/candidate';
|
||||||
|
|
||||||
|
export const load: PageServerLoad = async ({ fetch, cookies }) => {
|
||||||
|
await apiLogout(fetch);
|
||||||
|
|
||||||
|
cookies.delete('id', { path: '/' });
|
||||||
|
cookies.delete('key', { path: '/' });
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ cookies }) => {
|
|
||||||
// TODO: Nefunguje?!
|
|
||||||
await logout();
|
|
||||||
console.log(cookies);
|
|
||||||
cookies.delete('id', {path: '/'});
|
|
||||||
cookies.delete('key', {path: '/'});
|
|
||||||
throw redirect(302, '/auth/login');
|
throw redirect(302, '/auth/login');
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue