From 72f3d8c5ab3e2a42cf1a76d0c08815dbe46e50a1 Mon Sep 17 00:00:00 2001
From: Owen Jacobson <owen@grimoire.ca>
Date: Fri, 11 Oct 2024 01:18:18 -0400
Subject: Move login to its own route.

This - in passing - fixes the problem where the client failed to subscribe after logging in, by causing the whole subscription process to be re-run when returning to the main interface.
---
 ui/lib/components/LogIn.svelte | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'ui/lib/components/LogIn.svelte')

diff --git a/ui/lib/components/LogIn.svelte b/ui/lib/components/LogIn.svelte
index 2836e6d..e1cda8a 100644
--- a/ui/lib/components/LogIn.svelte
+++ b/ui/lib/components/LogIn.svelte
@@ -1,4 +1,5 @@
 <script>
+    import { goto } from '$app/navigation';
     import { logIn } from '$lib/apiServer';
     import { currentUser } from '$lib/store';
 
@@ -6,13 +7,14 @@
     let username = '';
     let password = '';
 
-    async function handleLogin(event) {
+    async function handleLogin() {
         disabled = true;
         const response = await logIn(username, password);
         if (200 <= response.status && response.status < 300) {
             currentUser.update(() => ({ username }));
             username = '';
             password = '';
+            goto('/');
         }
         disabled = false;
     }
-- 
cgit v1.2.3

