diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index b55ec41..9f7c10f 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -2,6 +2,10 @@ import '$lib/app.css'; import Navigation from '$lib/ui/Navigation.svelte'; import Widgets from '$lib/ui/Widgets.svelte'; + import { Client } from '$lib/client/client.js'; + import { get } from 'svelte/store'; + + let client = get(Client.get());
@@ -11,7 +15,13 @@
- + {#await client.verifyCredentials()} +
+ just a moment... +
+ {:then} + + {/await}
diff --git a/src/routes/post/[id]/+page.js b/src/routes/post/[id]/+page.js index e9f391c..30569fd 100644 --- a/src/routes/post/[id]/+page.js +++ b/src/routes/post/[id]/+page.js @@ -2,12 +2,16 @@ import Post from '$lib/ui/post/Post.svelte'; import { Client } from '$lib/client/client.js'; import { parsePost } from '$lib/client/api.js'; import { get } from 'svelte/store'; +import { goto } from '$app/navigation'; export const ssr = false; export async function load({ params }) { let client = get(Client.get()); - await client.verifyCredentials(); + + if (!client.instance || !client.user) { + goto("/"); + } const post_id = params.id;