feat: Fix axios interceptors.

This commit is contained in:
Ahmed Bouhuolia
2020-05-26 17:51:00 +02:00
parent dd49774f93
commit 72ba394c53
15 changed files with 369 additions and 223 deletions

View File

@@ -26,6 +26,12 @@ export function login({ form }) {
});
}
export const logout = () => {
return dispatch => dispatch({
type: t.LOGOUT,
});
};
export const register = ({ form }) => {
return (dispatch) => {
return new Promise((resolve, reject) => {

View File

@@ -0,0 +1,12 @@
export const setGlobalErrors = (errors) => {
return dispatch => {
dispatch({
type: 'GLOBAL_ERRORS_SET',
payload: {
errors,
},
});
}
}

View File

@@ -0,0 +1,17 @@
import { createReducer } from '@reduxjs/toolkit';
import t from 'store/types';
const initialState = {
data: {},
};
export default createReducer(initialState, {
['GLOBAL_ERRORS_SET']: (state, action) => {
const { errors } = action.payload;
state.data = {
...state.data,
...errors,
};
},
});

View File

@@ -16,6 +16,8 @@ import settings from './settings/settings.reducer';
import manualJournals from './manualJournals/manualJournals.reducers';
import globalSearch from './search/search.reducer';
import exchangeRates from './ExchangeRate/exchange.reducer'
import globalErrors from './globalErrors/globalErrors.reducer';
export default combineReducers({
authentication,
@@ -33,6 +35,6 @@ export default combineReducers({
itemCategories,
settings,
globalSearch,
exchangeRates
exchangeRates,
globalErrors,
});