feat: logout prev user before accepting new invite

This commit is contained in:
Rotimi Best
2024-07-08 07:13:00 +01:00
parent d87fceeaa5
commit 13b493f22b
2 changed files with 9 additions and 3 deletions
@@ -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');
}
}