Skip to content

Instantly share code, notes, and snippets.

@whisher
Created August 8, 2018 19:23
Show Gist options
  • Save whisher/abf898fcd956f4a028c0988972d0ff75 to your computer and use it in GitHub Desktop.
Save whisher/abf898fcd956f4a028c0988972d0ff75 to your computer and use it in GitHub Desktop.
export function clearState(reducer: ActionReducer<State>): ActionReducer<State> {
return function(state: State, action: Action): State {
console.log('action',action.type);
console.log('state',state);
if (action.type === '[Auth] Logout') {
console.log('BINGO');
state = undefined;
}
return reducer(state, action);
};
}
export const metaReducers: MetaReducer<State>[] =
!environment.production ? [storeFreeze, localStorageSyncReducer, clearState] : [localStorageSyncReducer, clearState];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment