From 596459e4d754df3ef2c3360e3f4228dbfc9b3a9c Mon Sep 17 00:00:00 2001 From: ari melody Date: Sun, 30 Jun 2024 21:39:37 +0100 Subject: [PATCH] fixed some inconsistency with verifying client credentials --- src/routes/+layout.svelte | 12 +++++++++++- src/routes/post/[id]/+page.js | 6 +++++- 2 files changed, 16 insertions(+), 2 deletions(-) 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;