Clear sessionstorage

This commit is contained in:
Vesa Luusua 2018-03-09 14:51:51 +02:00
parent 7100a7421a
commit 2feebc0f2a

View file

@ -15,6 +15,12 @@ const appReducer = combineReducers({ ...globalReducers, ...pageReducers });
const createReducer = () => {
return (state, action) => {
const appState = action.type === USER_LOGOUT ? undefined : state;
// Clear sessionStorage when logging out.
if (action.type === USER_LOGOUT && typeof window !== 'undefined' && !!window.sessionStorage) {
window.sessionStorage.clear();
}
return appReducer(appState, action);
};
};