fixed some inconsistency with verifying client credentials
This commit is contained in:
parent
73afcf6123
commit
596459e4d7
|
@ -2,6 +2,10 @@
|
||||||
import '$lib/app.css';
|
import '$lib/app.css';
|
||||||
import Navigation from '$lib/ui/Navigation.svelte';
|
import Navigation from '$lib/ui/Navigation.svelte';
|
||||||
import Widgets from '$lib/ui/Widgets.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());
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="app">
|
<div id="app">
|
||||||
|
@ -11,7 +15,13 @@
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<slot></slot>
|
{#await client.verifyCredentials()}
|
||||||
|
<div class="loading throb">
|
||||||
|
<span>just a moment...</span>
|
||||||
|
</div>
|
||||||
|
{:then}
|
||||||
|
<slot></slot>
|
||||||
|
{/await}
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<div id="widgets">
|
<div id="widgets">
|
||||||
|
|
|
@ -2,12 +2,16 @@ import Post from '$lib/ui/post/Post.svelte';
|
||||||
import { Client } from '$lib/client/client.js';
|
import { Client } from '$lib/client/client.js';
|
||||||
import { parsePost } from '$lib/client/api.js';
|
import { parsePost } from '$lib/client/api.js';
|
||||||
import { get } from 'svelte/store';
|
import { get } from 'svelte/store';
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
export const ssr = false;
|
export const ssr = false;
|
||||||
|
|
||||||
export async function load({ params }) {
|
export async function load({ params }) {
|
||||||
let client = get(Client.get());
|
let client = get(Client.get());
|
||||||
await client.verifyCredentials();
|
|
||||||
|
if (!client.instance || !client.user) {
|
||||||
|
goto("/");
|
||||||
|
}
|
||||||
|
|
||||||
const post_id = params.id;
|
const post_id = params.id;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue