mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
feat: Fix axios interceptors.
This commit is contained in:
@@ -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) => {
|
||||
|
||||
12
client/src/store/globalErrors/globalErrors.actions.js
Normal file
12
client/src/store/globalErrors/globalErrors.actions.js
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
|
||||
export const setGlobalErrors = (errors) => {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: 'GLOBAL_ERRORS_SET',
|
||||
payload: {
|
||||
errors,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
17
client/src/store/globalErrors/globalErrors.reducer.js
Normal file
17
client/src/store/globalErrors/globalErrors.reducer.js
Normal 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,
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user