BOD-84 Added base calculations for schedule load

This commit is contained in:
Patrick Fic
2020-05-08 15:33:08 -07:00
parent 3d74a4106e
commit 6096fce7a6
17 changed files with 456 additions and 122 deletions

View File

@@ -3,10 +3,43 @@ import ApplicationActionTypes from "./application.types";
const INITIAL_STATE = {
loading: false,
breadcrumbs: [],
scheduleLoad: {
load: [],
calculating: false,
error: null,
},
};
const applicationReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case ApplicationActionTypes.SET_BREAD_CRUMBS:
return {
...state,
breadcrumbs: action.payload,
};
case ApplicationActionTypes.CALCULATE_SCHEDULE_LOAD:
return {
...state,
scheduleLoad: { ...state.scheduleLoad, calculating: true, error: null },
};
case ApplicationActionTypes.CALCULATE_SCHEDULE_LOAD_SUCCESS:
return {
...state,
scheduleLoad: {
...state.scheduleLoad,
load: action.payload,
calculating: false,
},
};
case ApplicationActionTypes.CALCULATE_SCHEDULE_LOAD_FAILURE:
return {
...state,
scheduleLoad: {
...state.scheduleLoad,
calculating: false,
error: action.payload,
},
};
case ApplicationActionTypes.START_LOADING:
return {
...state,
@@ -17,11 +50,7 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
...state,
loading: false,
};
case ApplicationActionTypes.SET_BREAD_CRUMBS:
return {
...state,
breadcrumbs: action.payload,
};
default:
return state;
}