fix: org data persists after logout (#52)
* fix logout bug * Update index.svelte --------- Co-authored-by: macbook <[email protected]> Co-authored-by: Rotimi Best <[email protected]>
This commit is contained in:
co-authored by
macbook
Rotimi Best
parent
0081a6a910
commit
c1d1b820d2
@@ -5,11 +5,26 @@
|
|||||||
import { VARIANTS } from '$lib/components/PrimaryButton/constants';
|
import { VARIANTS } from '$lib/components/PrimaryButton/constants';
|
||||||
import { supabase } from '$lib/utils/functions/supabase';
|
import { supabase } from '$lib/utils/functions/supabase';
|
||||||
import { capturePosthogEvent } from '$lib/utils/services/posthog';
|
import { capturePosthogEvent } from '$lib/utils/services/posthog';
|
||||||
|
import { currentOrg, orgs } from '$lib/utils/store/org';
|
||||||
|
|
||||||
async function logout() {
|
async function logout() {
|
||||||
const { error } = await supabase.auth.signOut();
|
const { error } = await supabase.auth.signOut();
|
||||||
console.error('Error logging out: ', error);
|
console.error('Error logging out: ', error);
|
||||||
|
|
||||||
|
// Reset organization values, TODO: consider abstracting if needed in other places
|
||||||
|
currentOrg.set({
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
shortName: '',
|
||||||
|
siteName: '',
|
||||||
|
avatar_url: '',
|
||||||
|
memberId: '',
|
||||||
|
role_id: '',
|
||||||
|
landingpage: {},
|
||||||
|
theme: ''
|
||||||
|
})
|
||||||
|
orgs.set([]);
|
||||||
|
|
||||||
capturePosthogEvent('user_logged_out');
|
capturePosthogEvent('user_logged_out');
|
||||||
posthog.reset();
|
posthog.reset();
|
||||||
goto('/login');
|
goto('/login');
|
||||||
|
|||||||
Reference in New Issue
Block a user