diff --git a/src/routes/(main)/account/+page.server.ts b/src/routes/(main)/account/+page.server.ts index 5ab010d..cdcb215 100644 --- a/src/routes/(main)/account/+page.server.ts +++ b/src/routes/(main)/account/+page.server.ts @@ -1,6 +1,6 @@ import { redirect } from '@sveltejs/kit'; import type { Actions } from '@sveltejs/kit'; -import { fail, message, setError, superValidate } from 'sveltekit-superforms'; +import { fail, message, superValidate } from 'sveltekit-superforms'; import { zod } from 'sveltekit-superforms/adapters'; import { auth } from '$lib/server/db/auth'; import { changeUsernameSchema, changePasswordSchema } from '$lib/types/schema.js'; @@ -48,5 +48,11 @@ export const actions = { redirect(303, '/goodbye'); }, - signOut: async () => {}, + signOut: async ({ request }) => { + auth.api.signOut({ + headers: request.headers, + }); + + redirect(303, '/login'); + }, } satisfies Actions; diff --git a/src/routes/(main)/account/+page.svelte b/src/routes/(main)/account/+page.svelte index 5db0d8e..8784b4b 100644 --- a/src/routes/(main)/account/+page.svelte +++ b/src/routes/(main)/account/+page.svelte @@ -21,7 +21,7 @@