diff options
Diffstat (limited to 'ui/lib/components/LogOut.svelte')
| -rw-r--r-- | ui/lib/components/LogOut.svelte | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/ui/lib/components/LogOut.svelte b/ui/lib/components/LogOut.svelte deleted file mode 100644 index ba0861a..0000000 --- a/ui/lib/components/LogOut.svelte +++ /dev/null @@ -1,26 +0,0 @@ -<script> - import { goto } from '$app/navigation'; - import { logOut} from '$lib/apiServer'; - import { currentUser } from '$lib/store'; - - async function handleLogout() { - const response = await logOut(); - if (200 <= response.status && response.status < 300) { - currentUser.update(() => null); - goto('/login'); - } - } -</script> - -<form on:submit|preventDefault={handleLogout}> - {#if $currentUser} - @{$currentUser.username} - {/if} - <button - class="border-slate-500 border-solid border-2 font-bold p-1 rounded" - type="submit" - >log out</button> -</form> - -<style> -</style> |
