ngrx-store-localstorage
ngrx-store-localstorage copied to clipboard
It load the wrong data (strange)
I'm using this to persist my data :
export function sessionStorage(reducer: ActionReducer<any>): ActionReducer<any> {
const config: LocalStorageConfig = {
keys: ['token', 'user', 'isLoggedIn'],
rehydrate: true,
removeOnUndefined: false
};
return localStorageSync(config)(reducer);
}
StoreModule.forFeature('auth', authenticationReducer, { initialState, metaReducers: [sessionStorage] }),
If I dispatch the action LOGIN with user ADMIN and after that, logou, and after that LOGIN with user TESTE when a refresh the page (F5) it get the user ADMIN and his token the correct would be the TESTE user, who logged last.
Did you tried to logout on TESTE user then login, then refresh to see if the token is the belonged to the TESTE user?
Either way, if you don't mind, I'd like to see the log in and log out reducer.