2023-11-19 01:47:12 +01:00
|
|
|
<script>
|
|
|
|
import { config, user } from '$lib/stores';
|
|
|
|
import { goto } from '$app/navigation';
|
2023-11-19 06:41:43 +01:00
|
|
|
import { onMount, tick } from 'svelte';
|
2023-11-19 01:47:12 +01:00
|
|
|
|
2023-11-19 06:41:43 +01:00
|
|
|
let loaded = false;
|
|
|
|
onMount(async () => {
|
|
|
|
if ($config && $config.auth && $user === undefined) {
|
|
|
|
await goto('/auth');
|
|
|
|
}
|
|
|
|
|
|
|
|
await tick();
|
|
|
|
loaded = true;
|
|
|
|
});
|
2023-11-19 01:47:12 +01:00
|
|
|
</script>
|
|
|
|
|
2023-11-19 06:41:43 +01:00
|
|
|
{#if loaded}
|
2023-11-19 01:47:12 +01:00
|
|
|
<slot />
|
|
|
|
{/if}
|