summaryrefslogtreecommitdiff
path: root/hi-ui/src/lib/LogOut.svelte
blob: 439a5304e2d68fc90c72c4f2600403a8c67e5e26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<script>
    import { logOut} from '../apiServer';
    import { currentUser } from '../store';

    async function handleLogout(event) {
        event.preventDefault();
        const response = await logOut();
        if (200 <= response.status && response.status < 300) {
            currentUser.update(() => null);
        }
    }
</script>

<form on:submit={handleLogout}>
    <button type="submit">log out</button>
</form>

<style>
</style>