From 5ff106e910544788bc916626ae7665cb26e5af30 Mon Sep 17 00:00:00 2001
From: Owen Jacobson <owen@grimoire.ca>
Date: Fri, 11 Oct 2024 20:55:36 -0400
Subject: Provide a separate "initial setup" endpoint that creates a user.

---
 ui/routes/(app)/+layout.svelte | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

(limited to 'ui/routes/(app)/+layout.svelte')

diff --git a/ui/routes/(app)/+layout.svelte b/ui/routes/(app)/+layout.svelte
index 0f8e83c..38df9b9 100644
--- a/ui/routes/(app)/+layout.svelte
+++ b/ui/routes/(app)/+layout.svelte
@@ -26,23 +26,23 @@
     }
 
 	onMount(async () => {
-        try {
-            let response = await boot();
-            switch (response.status) {
-                case 200:
-                    onBooted(response.data);
-                    events = subscribeToEvents(response.data.resume_point);
-                    break;
-                case 401:
-                    currentUser.update(() => null);
-                    goto('/login');
-                    break;
-                default:
-                    // TODO: display error.
-                    break;
-            }
-        } catch (_) {
-            // I don't want exceptions on non-200 series responses, dammit.
+        let response = await boot();
+        switch (response.status) {
+            case 200:
+                onBooted(response.data);
+                events = subscribeToEvents(response.data.resume_point);
+                break;
+            case 401:
+                currentUser.update(() => null);
+                goto('/login');
+                break;
+            case 409:
+                currentUser.update(() => null);
+                goto('/setup');
+                break;
+            default:
+                // TODO: display error.
+                break;
         }
         loading = false;
 	});
-- 
cgit v1.2.3

