Răsfoiți Sursa

redirect to home after auth

Daniel Bohry 9 luni în urmă
părinte
comite
8eb7ac603f
1 a modificat fișierele cu 2 adăugiri și 0 ștergeri
  1. 2 0
      src/routes/login/+page.svelte

+ 2 - 0
src/routes/login/+page.svelte

@@ -1,6 +1,7 @@
 <script>
 	import { onMount } from 'svelte';
 	import { authentication } from '../store.js';
+	import { goto } from '$app/navigation';
 
 	let isAuthenticated = false;
 	let isLoading = true;
@@ -56,6 +57,7 @@
 				const result = await response.json();
 				authentication.set(result);
 				localStorage.setItem('authentication', JSON.stringify(result));
+				await goto("/home");
 			} else {
 				const error = await response.json();
 				console.error('Login failed:', error);