File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { browser } from '$app/environment' ;
2- import { goto } from '$app/navigation' ;
32import { IsAuthenticated } from '$lib/stores/AuthenticatedStore' ;
43import { UserStore } from '$lib/stores/UserStore' ;
4+ import { redirect } from '@sveltejs/kit' ;
55import { get } from 'svelte/store' ;
66
77// Makes the load function only run in browser
@@ -18,7 +18,7 @@ export function load() {
1818 // On loading in the anonymous section, check if cookie is set, if it is send us to the authenticated section
1919 if ( get ( IsAuthenticated ) ) {
2020 console . log ( '(anonymous)/+layout.ts (browser) - redirect' ) ;
21- goto ( '/home' ) ;
21+ redirect ( 302 , '/home' ) ;
2222 }
2323
2424 // If we make it to the anonymous section, make sure that userstore is clear, else behaviour will look weird
Original file line number Diff line number Diff line change 11import { browser } from '$app/environment' ;
2- import { goto } from '$app/navigation' ;
32import { IsAuthenticated } from '$lib/stores/AuthenticatedStore' ;
3+ import { redirect } from '@sveltejs/kit' ;
44import { get } from 'svelte/store' ;
55
66// The pages below this one will be different from user-to-user so cannot be prerendered and really shouldnt be server rendered
@@ -16,6 +16,6 @@ export function load({ url }) {
1616 // On loading in the anonymous section, check if cookie is set, if it is send us to the authenticated section
1717 if ( ! get ( IsAuthenticated ) ) {
1818 console . log ( '(anonymous)/+layout.ts (browser) - redirect' ) ;
19- goto ( `/login?redirect=${ url . pathname } ` ) ;
19+ redirect ( 302 , `/login?redirect=${ url . pathname } ` ) ;
2020 }
2121} ;
Original file line number Diff line number Diff line change 11import { browser } from '$app/environment' ;
2- import { goto } from '$app/navigation' ;
32import { accountV1Api } from '$lib/api/index.js' ;
43import { initializeSignalR } from '$lib/signalr' ;
54import { IsAuthenticated } from '$lib/stores/AuthenticatedStore' ;
65import { initializeDarkModeStore } from '$lib/stores/ColorSchemeStore.js' ;
76import { initializeFlashManagersStore } from '$lib/stores/FlashManagersStore.js' ;
87import { initializeSerialPortsStore } from '$lib/stores/SerialPortsStore.js' ;
98import { initializeUserStore , UserStore } from '$lib/stores/UserStore.js' ;
9+ import { redirect } from '@sveltejs/kit' ;
1010import { get } from 'svelte/store' ;
1111
1212// Set the default for the application
@@ -32,7 +32,7 @@ export async function load({ data, url }) {
3232 }
3333
3434 // Go to landing page
35- goto ( '/' ) ;
35+ redirect ( 302 , '/' ) ;
3636 return ;
3737 }
3838
You can’t perform that action at this time.
0 commit comments