fix hot bugs.

This commit is contained in:
Ahmed Bouhuolia
2020-04-26 03:09:33 +02:00
parent d14ff872d4
commit e01ad95ac3
31 changed files with 251 additions and 350 deletions

View File

@@ -3,6 +3,7 @@ import t from 'store/types';
const initialState = {
token: '',
organization: '',
user: '',
locale: '',
errors: [],
@@ -10,8 +11,10 @@ const initialState = {
export default createReducer(initialState, {
[t.LOGIN_SUCCESS]: (state, action) => {
state.token = action.token;
state.user = action.user;
const { token, user } = action.payload;
state.token = token;
state.user = user;
state.organization = user.tenant.organization_id;
},
[t.LOGIN_FAILURE]: (state, action) => {
@@ -21,6 +24,7 @@ export default createReducer(initialState, {
[t.LOGOUT]: (state) => {
state.token = '';
state.user = {};
state.organization = '';
},
[t.LOGIN_CLEAR_ERRORS]: (state) => {