This repository has no description
1<script lang="ts">
2 import { resolve } from "$app/paths";
3 import { goto } from "$app/navigation";
4 import { getAuth } from "$lib/auth.svelte";
5 import { onMount } from "svelte";
6
7 const auth = getAuth();
8 const appPath = (path: string) => resolve(path as "/");
9
10 onMount(() => {
11 void (async () => {
12 try {
13 const target = await auth.completeSignIn();
14 await goto(appPath(target), { replaceState: true });
15 } catch (e) {
16 console.error(e);
17 }
18 })();
19 });
20</script>
21
22<svelte:head>
23 <title>Signing in · Tangled</title>
24</svelte:head>
25
26{#if auth.state.kind === "failed"}
27 <section class="mx-auto flex max-w-md flex-col items-center gap-4 px-7 py-16 text-center">
28 <p class="typography-paragraph-large text-foreground-danger">{auth.state.message}</p>
29 <a href={appPath("/login")} class="inline-flex underline">Try again</a>
30 </section>
31{:else}
32 <p class="sr-only" role="status">Signing you in…</p>
33{/if}