diff --git a/apps/dashboard/src/lib/utils/functions/logout.ts b/apps/dashboard/src/lib/utils/functions/logout.ts index 232549d8..923717c0 100644 --- a/apps/dashboard/src/lib/utils/functions/logout.ts +++ b/apps/dashboard/src/lib/utils/functions/logout.ts @@ -5,7 +5,7 @@ import { currentOrg, orgs, defaultCurrentOrgState } from '$lib/utils/store/org'; import { user, profile, defaultProfileState, defaultUserState } from '$lib/utils/store/user'; import { goto } from '$app/navigation'; -export async function logout() { +export async function logout(redirect = true) { const { error } = await supabase.auth.signOut(); if (error) { @@ -19,5 +19,8 @@ export async function logout() { capturePosthogEvent('user_logged_out'); posthog.reset(); - goto('/login'); + + if (redirect) { + goto('/login'); + } } diff --git a/apps/dashboard/src/routes/invite/t/[hash]/+page.svelte b/apps/dashboard/src/routes/invite/t/[hash]/+page.svelte index 0d471875..a06b9d54 100644 --- a/apps/dashboard/src/routes/invite/t/[hash]/+page.svelte +++ b/apps/dashboard/src/routes/invite/t/[hash]/+page.svelte @@ -12,9 +12,10 @@ import AuthUI from '$lib/components/AuthUI/index.svelte'; import { currentOrg, currentOrgPath } from '$lib/utils/store/org'; import { setTheme } from '$lib/utils/functions/theme'; - import type { CurrentOrg } from '$lib/utils/types/org.js'; + import type { CurrentOrg } from '$lib/utils/types/org'; import { onMount } from 'svelte'; import type { Profile } from '$lib/components/Course/components/People/types'; + import { logout } from '$lib/utils/functions/logout'; export let data; @@ -128,6 +129,8 @@ onMount(() => { setTheme(data.currentOrg?.theme || ''); + + logout(false); }); $: errors.confirmPassword = getConfirmPasswordError(fields);