fix: settings

This commit is contained in:
elforjani3
2020-09-30 19:01:07 +02:00
parent 7d8b05ff66
commit 23f381065a
3 changed files with 78 additions and 51 deletions

View File

@@ -1,4 +1,4 @@
import {createReducer} from '@reduxjs/toolkit';
import { createReducer } from '@reduxjs/toolkit';
import t from 'store/types';
const initialState = {
@@ -11,10 +11,10 @@ const initialState = {
export default createReducer(initialState, {
[t.LOGIN_SUCCESS]: (state, action) => {
const { token, user } = action.payload;
const { token, user, tenant } = action.payload;
state.token = token;
state.user = user;
state.organization = user.tenant.organization_id;
state.organization = tenant.organization_id;
},
[t.LOGIN_FAILURE]: (state, action) => {
@@ -34,5 +34,5 @@ export default createReducer(initialState, {
export const isAuthenticated = (state) => !!state.authentication.token;
export const hasErrorType = (state, errorType) => {
return state.authentication.errors.find(e => e.type === errorType);
};
return state.authentication.errors.find((e) => e.type === errorType);
};