1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-10 01:16:39 +02:00
unleash.unleash/frontend/src/store/user/index.js

22 lines
639 B
JavaScript

import { Map as $Map } from 'immutable';
import { UPDATE_USER } from './actions';
import { AUTH_REQUIRED } from '../util';
const userStore = (state = new $Map(), action) => {
switch (action.type) {
case UPDATE_USER:
state = state
.set('profile', action.value)
.set('showDialog', false)
.set('authDetails', undefined);
return state;
case AUTH_REQUIRED:
state = state.set('authDetails', action.error.body).set('showDialog', true);
return state;
default:
return state;
}
};
export default userStore;