WIP for Reporting. Pulled out calculations to utility functions.
This commit is contained in:
23
src/redux/reporting/reporting.reducer.js
Normal file
23
src/redux/reporting/reporting.reducer.js
Normal 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;
|
||||
Reference in New Issue
Block a user