ngrx-store-localstorage icon indicating copy to clipboard operation
ngrx-store-localstorage copied to clipboard

It load the wrong data (strange)

Open duard opened this issue 6 years ago • 1 comments

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.

duard avatar Jul 21 '18 15:07 duard

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.

ernestomancebo avatar Aug 17 '18 14:08 ernestomancebo