mirror of
https://git.freecumextremist.com/grumbulon/pomme.git
synced 2024-05-19 05:26:06 +00:00
23 lines
382 B
Svelte
23 lines
382 B
Svelte
<script lang="ts">
|
|
import { goto } from '$app/navigation';
|
|
|
|
let promise = fetch(`/api/logout`, {
|
|
method: 'post'
|
|
}).then(async (response) => {
|
|
if (response.ok) {
|
|
goto('/');
|
|
} else {
|
|
const res = await response.json();
|
|
throw new Error(res.message);
|
|
}
|
|
});
|
|
</script>
|
|
|
|
{#await promise}
|
|
<p />
|
|
{:then}
|
|
<p />
|
|
{:catch error}
|
|
<p style="color: red">{error}</p>
|
|
{/await}
|