Added login and authentication
This commit is contained in:
@@ -1,12 +1,28 @@
|
||||
<script lang="ts">
|
||||
import "../app.css";
|
||||
import favicon from "$lib/assets/favicon.svg";
|
||||
import { afterNavigate } from "$app/navigation";
|
||||
import { isAuthenticated } from "$lib/Auth.svelte";
|
||||
|
||||
let { children } = $props();
|
||||
|
||||
let renderit = $state(false);
|
||||
|
||||
afterNavigate(() => {
|
||||
isAuthenticated()
|
||||
.then(() => {
|
||||
renderit = true;
|
||||
})
|
||||
.catch(() => {
|
||||
renderit = true;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<link rel="icon" href={favicon} />
|
||||
</svelte:head>
|
||||
|
||||
{@render children?.()}
|
||||
{#if renderit}
|
||||
{@render children?.()}
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user