소스 검색

redirect to home after auth

Daniel Bohry 9 달 전
부모
커밋
8eb7ac603f
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  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);