diff --git a/frontend/src/store/application/index.js b/frontend/src/store/application/index.js index 8dfc113fa9..3fe40cbf9e 100644 --- a/frontend/src/store/application/index.js +++ b/frontend/src/store/application/index.js @@ -1,5 +1,6 @@ import { fromJS, List, Map } from 'immutable'; import { RECEIVE_ALL_APPLICATIONS, RECEIVE_APPLICATION } from './actions'; +import { USER_LOGOUT, UPDATE_USER } from '../user/actions'; function getInitState() { return fromJS({ list: [], apps: {} }); @@ -11,6 +12,9 @@ const store = (state = getInitState(), action) => { return state.setIn(['apps', action.value.appName], new Map(action.value)); case RECEIVE_ALL_APPLICATIONS: return state.set('list', new List(action.value.applications)); + case USER_LOGOUT: + case UPDATE_USER: + return getInitState(); default: return state; } diff --git a/frontend/src/store/archive-store.js b/frontend/src/store/archive-store.js index c07db31492..a3453fccbb 100644 --- a/frontend/src/store/archive-store.js +++ b/frontend/src/store/archive-store.js @@ -1,5 +1,6 @@ import { List, Map as $Map } from 'immutable'; import { RECEIVE_ARCHIVE, REVIVE_TOGGLE } from './archive-actions'; +import { USER_LOGOUT, UPDATE_USER } from './user/actions'; function getInitState() { return new $Map({ list: new List() }); @@ -11,6 +12,9 @@ const archiveStore = (state = getInitState(), action) => { return state.update('list', list => list.filter(item => item.name !== action.value)); case RECEIVE_ARCHIVE: return state.set('list', new List(action.value)); + case USER_LOGOUT: + case UPDATE_USER: + return getInitState(); default: return state; } diff --git a/frontend/src/store/client-instance-store.js b/frontend/src/store/client-instance-store.js index f7deda4ae6..e65eab6233 100644 --- a/frontend/src/store/client-instance-store.js +++ b/frontend/src/store/client-instance-store.js @@ -1,5 +1,6 @@ import { fromJS } from 'immutable'; import { RECEIVE_CLIENT_INSTANCES } from './client-instance-actions'; +import { USER_LOGOUT, UPDATE_USER } from './user/actions'; function getInitState() { return fromJS([]); @@ -9,6 +10,9 @@ const store = (state = getInitState(), action) => { switch (action.type) { case RECEIVE_CLIENT_INSTANCES: return fromJS(action.value); + case USER_LOGOUT: + case UPDATE_USER: + return getInitState(); default: return state; } diff --git a/frontend/src/store/context/index.js b/frontend/src/store/context/index.js index ac39e3e5c4..3b56012bcd 100644 --- a/frontend/src/store/context/index.js +++ b/frontend/src/store/context/index.js @@ -1,5 +1,6 @@ import { List } from 'immutable'; import { RECEIVE_CONTEXT, REMOVE_CONTEXT, ADD_CONTEXT_FIELD, UPDATE_CONTEXT_FIELD } from './actions'; +import { USER_LOGOUT, UPDATE_USER } from '../user/actions'; const DEFAULT_CONTEXT_FIELDS = [{ name: 'environment' }, { name: 'userId' }, { name: 'appName' }]; @@ -19,6 +20,9 @@ const strategies = (state = getInitState(), action) => { const index = state.findIndex(item => item.name === action.context.name); return state.set(index, action.context); } + case USER_LOGOUT: + case UPDATE_USER: + return getInitState(); default: return state; } diff --git a/frontend/src/store/feature-store.js b/frontend/src/store/feature-store.js index 3bca31b835..9120633a2a 100644 --- a/frontend/src/store/feature-store.js +++ b/frontend/src/store/feature-store.js @@ -10,7 +10,7 @@ import { TOGGLE_FEATURE_TOGGLE, } from './feature-actions'; -import { USER_LOGOUT } from './user/actions'; +import { USER_LOGOUT, UPDATE_USER } from './user/actions'; const features = (state = new List([]), action) => { switch (action.type) { @@ -50,6 +50,7 @@ const features = (state = new List([]), action) => { case RECEIVE_FEATURE_TOGGLES: debug(RECEIVE_FEATURE_TOGGLES, action); return new List(action.featureToggles.map($Map)); + case UPDATE_USER: case USER_LOGOUT: debug(USER_LOGOUT, action); return new List([]); diff --git a/frontend/src/store/history-store.js b/frontend/src/store/history-store.js index 721285a823..b3ed5807b9 100644 --- a/frontend/src/store/history-store.js +++ b/frontend/src/store/history-store.js @@ -1,5 +1,6 @@ import { List, Map as $Map } from 'immutable'; import { RECEIVE_HISTORY, RECEIVE_HISTORY_FOR_TOGGLE } from './history-actions'; +import { USER_LOGOUT, UPDATE_USER } from './user/actions'; function getInitState() { return new $Map({ list: new List(), toggles: new $Map() }); @@ -11,6 +12,9 @@ const historyStore = (state = getInitState(), action) => { return state.setIn(['toggles', action.value.toggleName], new List(action.value.events)); case RECEIVE_HISTORY: return state.set('list', new List(action.value)); + case USER_LOGOUT: + case UPDATE_USER: + return getInitState(); default: return state; } diff --git a/frontend/src/store/input-store.js b/frontend/src/store/input-store.js index 08ab8c8d87..a594c4e5b3 100644 --- a/frontend/src/store/input-store.js +++ b/frontend/src/store/input-store.js @@ -1,5 +1,6 @@ import { Map as $Map, List, fromJS } from 'immutable'; import actions from './input-actions'; +import { USER_LOGOUT, UPDATE_USER } from './user/actions'; function getInitState() { return new $Map(); @@ -101,6 +102,9 @@ const inputState = (state = getInitState(), action) => { return updateInList(state, action); case actions.CLEAR: return clear(state, action); + case USER_LOGOUT: + case UPDATE_USER: + return getInitState(); default: // console.log('TYPE', action.type, action); return state; diff --git a/frontend/src/store/settings/index.js b/frontend/src/store/settings/index.js index ebd073c16c..1f5a0024e4 100644 --- a/frontend/src/store/settings/index.js +++ b/frontend/src/store/settings/index.js @@ -1,5 +1,6 @@ import { fromJS, Map as $Map } from 'immutable'; import { UPDATE_SETTING } from './actions'; +import { USER_LOGOUT, UPDATE_USER } from '../user/actions'; // TODO: provde a mock if localstorage does not exists? const localStorage = window.localStorage || {}; @@ -25,6 +26,9 @@ const settingStore = (state = getInitState(), action) => { switch (action.type) { case UPDATE_SETTING: return updateSetting(state, action); + case USER_LOGOUT: + case UPDATE_USER: + return getInitState(); default: return state; }