Authed page login logic
This commit is contained in:
parent
c1400c0120
commit
7879ca82fd
25
src/routes/registration/+layout.svelte
Normal file
25
src/routes/registration/+layout.svelte
Normal file
@ -0,0 +1,25 @@
|
||||
<script lang="ts">
|
||||
import userstore from '$lib/userstore';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
$: loginRendered = false;
|
||||
|
||||
onMount(() => {
|
||||
try {
|
||||
userstore.loginFromStorage();
|
||||
loginRendered = true;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
userstore.logout();
|
||||
location.replace(`${location.pathname}/login`);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if loginRendered}
|
||||
<slot />
|
||||
{:else}
|
||||
<div class="mx-auto mt-20">
|
||||
<h1 class="block text-center text-2xl font-bold text-gray-800 dark:text-white">Lade Anmeldedaten...</h1>
|
||||
</div>
|
||||
{/if}
|
Loading…
x
Reference in New Issue
Block a user