I am using Angular 2 with ngrx/store. I want to reset the whole store states when user dispatch USER_LOGOUT.
I read the Dan Abramov\'s answer of How to
This isn't really an answer but the comments won't let me format it correctly. To add to what cartant said, if you are setting up your types like this:
export const ActionTypes = {
LOGOUT: type('[Environment] Logout of portal'),
....
}
It's the long description that you should use. Also if you name your root reducer rootReducer instead of just reducer then you would change that as well. Following is an edited example:
(I left this function within my root reducer)
const developmentReducer: ActionReducer = compose(...DEV_REDUCERS,
(rootReducer: Function) => {
return function(state, action) {
if (action.type === '[Environment] Logout of portal') {
state = undefined;
}
return rootReducer(state, action);
};
}, combineReducers)(reducers);