feat: ssr fetch logout

This commit is contained in:
EETagent 2022-12-03 16:18:50 +01:00
parent dfd746be5a
commit 1226f34a54

View file

@ -1,13 +1,13 @@
import type { PageServerLoad } from './$types';
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');
};