AuthCheck Component

Show and hide content for the authenticated user

AuthCheck Component

+page.svelte
<script lang="ts">
    import { user } from "$lib/firebase";
</script>
  
{#if $user}
  <slot />
{:else}
    <p class="text-error">
        You must be signed in to view this page.
        <a class="btn btn-primary" href="/login">Sign in</a>
    </p>
{/if}

Questions? Let's chat

Open Discord