WIP for Reporting. Pulled out calculations to utility functions.

This commit is contained in:
Patrick Fic
2020-10-20 13:55:35 -07:00
parent 4290c8c497
commit 045346ce48
18 changed files with 345 additions and 57 deletions

View File

@@ -0,0 +1,23 @@
import ReportingActionTypes from "./reporting.types";
const INITIAL_STATE = {
dates: { startDate: null, endDate: null },
data: [],
scoreCard: null,
error: null,
loading: false,
};
const applicationReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case ReportingActionTypes.QUERY_REPORTING_DATA:
return { ...state, loading: true, dates: action.payload };
case ReportingActionTypes.SET_REPORTING_DATA:
return { ...state, data: action.payload };
case ReportingActionTypes.SET_SCORE_CARD:
return { ...state, loading: false, scoreCard: action.payload };
default:
return state;
}
};
export default applicationReducer;