From c1d1b820d2b3e10257a7b39e324312755675c2ee Mon Sep 17 00:00:00 2001 From: Vanessa Osuka <77996535+cannarron@users.noreply.github.com> Date: Fri, 1 Dec 2023 06:49:47 +0100 Subject: [PATCH] fix: org data persists after logout (#52) * fix logout bug * Update index.svelte --------- Co-authored-by: macbook Co-authored-by: Rotimi Best --- .../lib/components/Buttons/Logout/index.svelte | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apps/dashboard/src/lib/components/Buttons/Logout/index.svelte b/apps/dashboard/src/lib/components/Buttons/Logout/index.svelte index 2d240d1f..497671bc 100644 --- a/apps/dashboard/src/lib/components/Buttons/Logout/index.svelte +++ b/apps/dashboard/src/lib/components/Buttons/Logout/index.svelte @@ -5,11 +5,26 @@ import { VARIANTS } from '$lib/components/PrimaryButton/constants'; import { supabase } from '$lib/utils/functions/supabase'; import { capturePosthogEvent } from '$lib/utils/services/posthog'; + import { currentOrg, orgs } from '$lib/utils/store/org'; async function logout() { const { error } = await supabase.auth.signOut(); 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'); posthog.reset(); goto('/login');