ui: Redirect logged user from login and join page to home
This commit is contained in:
parent
75ab354723
commit
6d677eabaa
14
ui/src/routes/join/+page.ts
Normal file
14
ui/src/routes/join/+page.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { redirect, type Load } from '@sveltejs/kit';
|
||||
import { get_store_value } from 'svelte/internal';
|
||||
|
||||
import { userSession } from '$lib/stores/usersession';
|
||||
|
||||
export const load: Load = async({ parent }) => {
|
||||
const data = await parent();
|
||||
|
||||
if (get_store_value(userSession) != null) {
|
||||
throw redirect(302, '/');
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
14
ui/src/routes/login/+page.ts
Normal file
14
ui/src/routes/login/+page.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { redirect, type Load } from '@sveltejs/kit';
|
||||
import { get_store_value } from 'svelte/internal';
|
||||
|
||||
import { userSession } from '$lib/stores/usersession';
|
||||
|
||||
export const load: Load = async({ parent }) => {
|
||||
const data = await parent();
|
||||
|
||||
if (get_store_value(userSession) != null) {
|
||||
throw redirect(302, '/');
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
Loading…
Reference in New Issue
Block a user