Skip to content

Commit dcabd0f

Browse files
Force refresh when logging out
No doubt there's a nicer way to update things but I haven't been able to work it out
1 parent 7891982 commit dcabd0f

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

dashboard/src/lib/remote-functions/artist.remote.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,9 @@ export const updateArtistDetails = form(ArtistDetailsForm, async (data) => {
4747
});
4848
});
4949

50-
export const logOut = query(async () => {
50+
export const signOut = query(async () => {
5151
const { locals } = getRequestEvent();
52-
const { session } = await locals.safeGetSession();
53-
if (session) {
52+
if (locals.session) {
5453
await locals.supabase.auth.signOut();
55-
redirect(303, "/login");
5654
}
5755
});

dashboard/src/routes/+layout.svelte

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
import { dashboardState, type DashboardSectionId } from "$lib/state.svelte";
55
import { invalidate } from "$app/navigation";
66
import { onMount } from "svelte";
7-
import { logOut } from "$lib/remote-functions/artist.remote";
7+
import { signOut } from "$lib/remote-functions/artist.remote";
88
99
let { children, data } = $props();
1010
11-
let { supabase, session } = $derived(data);
12-
13-
const artists = $derived(data.artists);
11+
let { supabase, session, artists } = $derived(data);
1412
1513
onMount(() => {
1614
const { data } = supabase.auth.onAuthStateChange((_, newSession) => {
@@ -29,8 +27,12 @@
2927
];
3028
</script>
3129

30+
<svelte:head>
31+
<meta name="robots" content="noindex" />
32+
</svelte:head>
33+
3234
<div class="dashboard-container">
33-
{#if data.session}
35+
{#if session}
3436
<div class="side-panel">
3537
<h1>Soli • Dashboard</h1>
3638
<hr />
@@ -82,7 +84,13 @@
8284
{/each}
8385
{/if}
8486
<hr />
85-
<button onclick={() => logOut()}>Sign Out</button>
87+
<button
88+
onclick={() => {
89+
signOut().then(() => {
90+
location.reload();
91+
});
92+
}}>Sign Out</button
93+
>
8694
</div>
8795
{/if}
8896

dashboard/src/routes/login/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</script>
2222

2323
<svelte:head>
24-
<title>Login • Soli</title>
24+
<title>Login • Soli Dashboard</title>
2525
</svelte:head>
2626

2727
<div class="wrapper">

0 commit comments

Comments
 (0)