Skip to content

Commit

Permalink
feat: add per component authorization handling
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnuchandrappan committed Nov 23, 2024
1 parent 3134e28 commit 692f026
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/dev/sveltekit/src/components/header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<div class="links">
<a class="linkItem" href="/">Home</a>
<a class="linkItem" href="/protected">Protected</a>
<a class="linkItem" href="/client-protected">Client Protected</a>
<a class="linkItem" href="/users">Admin</a>
</div>
</header>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script lang="ts">
import { page } from "$app/stores"
</script>

{#if $page.data.session}
<h1>Protected without hooks.server.ts</h1>
<p>This page is protected and can only be accessed by authenticated users.</p>
{:else}
<h1>Access Denied</h1>
{/if}

0 comments on commit 692f026

Please sign in to comment.