Skip to content

Commit d9ab73f

Browse files
committed
Fix auth loading state a bit
1 parent 7c63219 commit d9ab73f

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,21 @@
11
<script lang="ts">
22
import { goto } from '$app/navigation';
3-
import { page } from '$app/state';
43
import Container from '$lib/components/Container.svelte';
54
import LoadingCircle from '$lib/components/svg/LoadingCircle.svelte';
6-
import { Button } from '$lib/components/ui/button';
75
import { UserStore } from '$lib/stores/UserStore';
86
import type { Snippet } from 'svelte';
97
108
let { children }: { children: Snippet } = $props();
119
1210
$effect(() => {
13-
if (!$UserStore.loading && !$UserStore.self) {
14-
goto(page.url.searchParams.get('redirect') ?? '/login');
15-
}
11+
if (!$UserStore.loading && !$UserStore.self) goto('/login');
1612
});
1713
</script>
1814

19-
{#if $UserStore.loading}
15+
{#if !$UserStore.self}
2016
<Container>
2117
<LoadingCircle class="size-20" />
2218
</Container>
23-
{:else if $UserStore.self === null}
24-
<Container>
25-
<h1 class="text-4xl">You need to be logged in to access this page</h1>
26-
<Button href="/login">Login</Button>
27-
</Container>
2819
{:else}
2920
{@render children()}
3021
{/if}

0 commit comments

Comments
 (0)