diff --git a/src/app/dashboard/components/UserAvatar.tsx b/src/app/dashboard/components/UserAvatar.tsx index 2421912..19a65e8 100644 --- a/src/app/dashboard/components/UserAvatar.tsx +++ b/src/app/dashboard/components/UserAvatar.tsx @@ -30,6 +30,9 @@ export default function UserAvatar({ session }: { session: Session | null }) { const updateUserSettings = useUserSettingsStore( (state) => state.updateUserSettings, ); + const clearUserSettings = useUserSettingsStore( + (state) => state.clearUserSettings, + ); const unauthenticatedMenuItems: MenuItem[] = [ { key: 'signin', @@ -58,7 +61,7 @@ export default function UserAvatar({ session }: { session: Session | null }) { key: 'signout', onPress: async () => { await signOut(); - updateUserSettings({}, false); + clearUserSettings(); const logoutUrl = new URL( `${process.env.NEXT_PUBLIC_AUTH_KEYCLOAK_ISSUER}/protocol/openid-connect/logout`, ); diff --git a/src/app/stores/userSettingsStore.ts b/src/app/stores/userSettingsStore.ts index d258867..32a64cc 100644 --- a/src/app/stores/userSettingsStore.ts +++ b/src/app/stores/userSettingsStore.ts @@ -3,7 +3,6 @@ import { devtools, persist } from 'zustand/middleware'; import type {} from '@redux-devtools/extension'; import { UserSettingsDto } from '@/app/api.types'; // required for devtools typing import { logger } from '@/logger'; -import toast from 'react-hot-toast'; const log = logger.child({ module: 'error' }); @@ -13,6 +12,7 @@ interface UserSettingsState { updatedSettings: Partial, persist?: boolean, ) => void; + clearUserSettings: () => void; } export const useUserSettingsStore = create()( @@ -52,6 +52,9 @@ export const useUserSettingsStore = create()( })); } }, + clearUserSettings: () => { + set({ userSettings: {} }); + }, }), { name: 'user-settings-storage',