From 1d8b828d1bbe0e0daa64f6fc2689799c7169afa0 Mon Sep 17 00:00:00 2001
From: Kit La Touche <kit@transneptune.net>
Date: Thu, 19 Sep 2024 23:26:39 -0400
Subject: Add basic browser client

Using Svelte.

No tests, no linting, yet.

This is just starting to get familiar with things.

You'll still have to run the dev server and the dev client builder each
in their own terminals.

Enjoy!
---
 hi-ui/src/lib/LogOut.svelte | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 hi-ui/src/lib/LogOut.svelte

(limited to 'hi-ui/src/lib/LogOut.svelte')

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>
-- 
cgit v1.2.3

