add loading while adding fees to ORD

This commit is contained in:
Bilal Catic
2019-07-25 03:01:09 +02:00
parent a5221da2f1
commit 84befa07ae
4 changed files with 53 additions and 7 deletions

View File

@@ -0,0 +1,38 @@
import {
ADD_FEES_TO_ORD_PENDING,
ADD_FEES_TO_ORD_SUCCESS,
ADD_FEES_TO_ORD_FAILED,
} from '../constants';
const initialState = {
pending: false,
result: null,
error: null,
};
export const addFeesStatus = (state, action) => {
state = state || initialState;
action = action || {};
switch(action.type){
case ADD_FEES_TO_ORD_PENDING:
return Object.assign({}, state, {
pending: true,
error: null,
});
case ADD_FEES_TO_ORD_SUCCESS:
return Object.assign({}, state, {
pending: false,
result: action.payload,
error: null,
});
case ADD_FEES_TO_ORD_FAILED:
return Object.assign({}, state, {
pending: false,
result: {},
error: action.payload,
});
default:
return state;
}
};

View File

@@ -6,6 +6,7 @@ import { addMapping } from './addMappingReducer';
import { incidentsReport } from './incidentsReportReducer';
import { membersList } from './membersListReducer';
import { memberIncidents} from './memberIncidentsReducer';
import { addFeesStatus } from './addFeesToOrdReducer';
export const rootReducer = combineReducers({
doorLockData,
@@ -14,5 +15,6 @@ export const rootReducer = combineReducers({
incidentsReport,
membersList,
memberIncidents,
addFeesStatus,
});