migrate auth v2 code
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import { clearSession } from '$lib/server/auth';
|
||||
import { clearSessionCookie } from '$lib/server/session';
|
||||
|
||||
function signOut(event: { cookies: any }) {
|
||||
clearSessionCookie(event.cookies);
|
||||
event.cookies.delete('session', { path: '/' });
|
||||
event.cookies.delete('device_token', { path: '/' });
|
||||
}
|
||||
|
||||
export function load(event) {
|
||||
clearSession(event);
|
||||
signOut(event);
|
||||
throw redirect(303, '/');
|
||||
}
|
||||
|
||||
export const actions = {
|
||||
default: (event) => {
|
||||
clearSession(event);
|
||||
signOut(event);
|
||||
throw redirect(303, '/');
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user