blob: 8b182e75305cae205442d087f9a5e1cd7d645f98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<script>
import { goto } from '$app/navigation';
import { logOut } from '$lib/apiServer.js';
import { currentUser } from '$lib/store';
async function onsubmit(event) {
event.preventDefault();
const response = await logOut();
if (200 <= response.status && response.status < 300) {
currentUser.set(null);
goto('/login');
}
}
</script>
<form {onsubmit}>
<button type="submit">log out</button>
</form>
|