Add redirecting user from login page to main page after successful login
This commit is contained in:
parent
aa5a173e83
commit
92d3a15420
|
@ -1,4 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
|
import { goto } from "$app/navigation";
|
||||||
import { addSuccessToast } from "$lib/components/store";
|
import { addSuccessToast } from "$lib/components/store";
|
||||||
import Toasts from "$lib/components/Toasts.svelte";
|
import Toasts from "$lib/components/Toasts.svelte";
|
||||||
let username = $state("");
|
let username = $state("");
|
||||||
|
@ -23,8 +24,7 @@
|
||||||
credentials: "include", // Important to send cookies with requests
|
credentials: "include", // Important to send cookies with requests
|
||||||
});
|
});
|
||||||
addSuccessToast("Login successful!");
|
addSuccessToast("Login successful!");
|
||||||
// setToken(resp.token);
|
goto("/");
|
||||||
// goto("/test");
|
|
||||||
console.log(resp);
|
console.log(resp);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof Error) {
|
if (err instanceof Error) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user