slightly improve logout
This commit is contained in:
parent
0d5d936ef3
commit
ea8496b85a
@ -1,7 +1,8 @@
|
||||
import { redirect } from "@sveltejs/kit"
|
||||
import type { Actions, PageServerLoad } from "./$types"
|
||||
import redirect from "@sveltejs/kit"
|
||||
import type { Actions } from './$types';
|
||||
|
||||
export const load: PageServerLoad = async ({ cookies }) => {
|
||||
cookies.delete("UserSession")
|
||||
redirect(303, "/")
|
||||
}
|
||||
export const actions: Actions = {
|
||||
default: async ({cookies}) => {
|
||||
cookies.delete("UserSession")
|
||||
}
|
||||
} satisfies Actions;
|
||||
|
@ -1,12 +1,7 @@
|
||||
<script>
|
||||
import { redirect } from "@sveltejs/kit";
|
||||
import { afterNavigate } from '$app/navigation';
|
||||
import { onMount } from "svelte";
|
||||
afterNavigate(() => {
|
||||
redirect(303, "/")
|
||||
})
|
||||
onMount(() => {
|
||||
redirect(303, "/")
|
||||
})
|
||||
import "$lib/css/form.css"
|
||||
</script>
|
||||
<h1>Log Out</h1>
|
||||
<form method='POST'>
|
||||
<h1>Log out</h1>
|
||||
<button type='submit'>Log Out</button>
|
||||
</form>
|
||||
|
Loading…
Reference in New Issue
Block a user