Merge pull request #747 from sharetribe/clear-sessionstorage

Clear sessionstorage
This commit is contained in:
Vesa Luusua 2018-03-09 15:09:14 +02:00 committed by GitHub
commit c45fc8b69f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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);
};
};