blob: 8fa9ddd847326cd35238f45865a6682583da4103 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<script lang="ts">
import { page } from '$app/state';
import { checkScope } from '$lib/auth';
import type { Session } from '../../hooks.server';
let session = $derived(page.data.session as Session);
</script>
<svelte:head>
<title>Crunched - Home</title>
</svelte:head>
<article>
<h2 class="text-2xl">Home</h2>
<div>
{#if session}
<div>
<small>Signed in as</small><br />
<strong>{session.userInfo.preferred_username ?? 'User'}</strong>
</div>
<div>
<small>Scope</small><br />
<strong>{session.tokens.scope}</strong>
</div>
<button
onclick={() => {
alert(checkScope(session, ['vm-own-write'], true));
}}>need scope</button
>
<!-- <div slot="submitButton" class="buttonPrimary">Sign out</div> -->
{:else}
<span class="notSignedInText">You are not signed in</span>
{/if}
</div>
</article>
|