Skip to content

Commit

Permalink
fix: remove profile from redux persistor
Browse files Browse the repository at this point in the history
KK-1139
  • Loading branch information
nikomakela committed May 3, 2024
1 parent 882604f commit ea20d8e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/domain/app/state/AppStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ enableES5();
const persistConfig = {
key: 'root',
storage,
whitelist: ['profile', 'registration', 'event'],
whitelist: ['registration', 'event'],
};

const persistedReducer = persistReducer(persistConfig, rootReducer);
Expand Down
11 changes: 11 additions & 0 deletions src/domain/profile/ProfileProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { MyProfile } from './types/ProfileQueryTypes';
import { useIsFullyLoggedIn } from '../auth/useIsFullyLoggedIn';
import { profileSelector } from './state/ProfileSelectors';
import { clearProfile as clearProfileFromRedux } from './state/ProfileActions';
import { persistor } from '../app/state/AppStore';

export default function ProfileProvider({
children,
Expand Down Expand Up @@ -62,6 +63,16 @@ export default function ProfileProvider({
// eslint-disable-next-line no-console
console.info('Clearing profile from redux');
clearProfileFromRedux();
persistor
.purge()
.then(() => {
// eslint-disable-next-line no-console
console.info('Redux-persistor purged');
})
.catch((error) => {
// eslint-disable-next-line no-console
console.error(error);
});
}
}, [isAuthenticated, reduxStorageProfile?.id]);

Expand Down

0 comments on commit ea20d8e

Please sign in to comment.