ui: Redirect logged user from login and join page to home

This commit is contained in:
nemunaire 2023-01-11 10:06:37 +01:00
parent 75ab354723
commit 6d677eabaa
2 changed files with 28 additions and 0 deletions

View 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;
}

View 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;
}