slightly improve logout
This commit is contained in:
parent
0d5d936ef3
commit
ea8496b85a
@ -1,7 +1,8 @@
|
|||||||
import { redirect } from "@sveltejs/kit"
|
import redirect from "@sveltejs/kit"
|
||||||
import type { Actions, PageServerLoad } from "./$types"
|
import type { Actions } from './$types';
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ cookies }) => {
|
export const actions: Actions = {
|
||||||
|
default: async ({cookies}) => {
|
||||||
cookies.delete("UserSession")
|
cookies.delete("UserSession")
|
||||||
redirect(303, "/")
|
}
|
||||||
}
|
} satisfies Actions;
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { redirect } from "@sveltejs/kit";
|
import "$lib/css/form.css"
|
||||||
import { afterNavigate } from '$app/navigation';
|
|
||||||
import { onMount } from "svelte";
|
|
||||||
afterNavigate(() => {
|
|
||||||
redirect(303, "/")
|
|
||||||
})
|
|
||||||
onMount(() => {
|
|
||||||
redirect(303, "/")
|
|
||||||
})
|
|
||||||
</script>
|
</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