fix fetching incidents for specific dates from frontend
This commit is contained in:
@@ -108,7 +108,7 @@ const mapStateToProps = (state) => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
fetchIncidents: () => fetchIncidents(dispatch),
|
fetchIncidents: (dateRange) => fetchIncidents(dispatch, dateRange),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(IncidentsReport);
|
export default connect(mapStateToProps, mapDispatchToProps)(IncidentsReport);
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ export const addNewMapping = (dispatch, mapping) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const fetchIncidents = (dispatch, dateRange) => {
|
export const fetchIncidents = (dispatch, dateRange) => {
|
||||||
|
const { startDate, endDate } = dateRange;
|
||||||
|
|
||||||
dispatch({type: FETCH_INCIDENTS_PENDING});
|
dispatch({type: FETCH_INCIDENTS_PENDING});
|
||||||
API.get('integration/report/allIncidents', {
|
API.get(`integration/report/allIncidents/${startDate}/${endDate}`)
|
||||||
dateRange
|
|
||||||
})
|
|
||||||
.then(response => {
|
.then(response => {
|
||||||
dispatch({type: FETCH_INCIDENTS_SUCCESS, payload: response.data});
|
dispatch({type: FETCH_INCIDENTS_SUCCESS, payload: response.data});
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user