diff --git a/src/lib/components/sidebar.svelte b/src/lib/components/sidebar.svelte index 2acd612..6df1c95 100644 --- a/src/lib/components/sidebar.svelte +++ b/src/lib/components/sidebar.svelte @@ -4,9 +4,22 @@ import { Button } from '$lib/components/ui/button' import * as Avatar from '$lib/components/ui/avatar' import * as DropdownMenu from '$lib/components/ui/dropdown-menu' + import * as AlertDialog from '$lib/components/ui/alert-dialog' - import { User } from 'lucide-svelte' + import { Loader2, User } from 'lucide-svelte' import { goto } from '$app/navigation' + + let dialogOpen = false + let isLoading = false + const logout = async () => { + isLoading = true + + await fetch('/api/logout', { method: 'post' }) + + isLoading = false + dialogOpen = false + goto('/login') + }