summaryrefslogtreecommitdiff
path: root/hi-ui/src/lib/LogOut.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'hi-ui/src/lib/LogOut.svelte')
-rw-r--r--hi-ui/src/lib/LogOut.svelte19
1 files changed, 19 insertions, 0 deletions
diff --git a/hi-ui/src/lib/LogOut.svelte b/hi-ui/src/lib/LogOut.svelte
new file mode 100644
index 0000000..439a530
--- /dev/null
+++ b/hi-ui/src/lib/LogOut.svelte
@@ -0,0 +1,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>