fix "Delete fee" on Member Incidents Report screen

This commit is contained in:
Bilal Catic
2019-11-21 15:12:41 +01:00
parent d4a949aaf0
commit 06a40e98e9
5 changed files with 34 additions and 10 deletions

View File

@@ -89,13 +89,17 @@ export const fetchIncidents = (dispatch, dateRange) => {
};
export const deleteIncidents = (dispatch, deleteData) => {
dispatch({type: FETCH_INCIDENTS_PENDING});
const pendingAction = deleteData.memberId ? FETCH_MEMBER_INCIDENTS_PENDING : FETCH_INCIDENTS_PENDING;
const successAction = deleteData.memberId ? FETCH_MEMBER_INCIDENTS_SUCCESS : FETCH_INCIDENTS_SUCCESS;
const failedAction = deleteData.memberId ? FETCH_MEMBER_INCIDENTS_FAILED : FETCH_INCIDENTS_FAILED;
dispatch({type: pendingAction});
API.delete(`/integration/fees`, { data: deleteData })
.then(response => {
dispatch({type: FETCH_INCIDENTS_SUCCESS, payload: response.data});
dispatch({type: successAction, payload: response.data});
})
.catch(error => {
dispatch({type: FETCH_INCIDENTS_FAILED, payload: error.response});
dispatch({type: failedAction, payload: error.response});
});
};