add action for sending update data to backend

This commit is contained in:
Bilal Catic
2020-01-09 01:29:06 +01:00
parent c78a0e4138
commit ff8a836fed
2 changed files with 37 additions and 3 deletions

View File

@@ -103,6 +103,21 @@ export const deleteIncidents = (dispatch, deleteData) => {
});
};
export const updateIncidentFees = (dispatch, updateData) => {
const pendingAction = updateData.memberId ? FETCH_MEMBER_INCIDENTS_PENDING : FETCH_INCIDENTS_PENDING;
const successAction = updateData.memberId ? FETCH_MEMBER_INCIDENTS_SUCCESS : FETCH_INCIDENTS_SUCCESS;
const failedAction = updateData.memberId ? FETCH_MEMBER_INCIDENTS_FAILED : FETCH_INCIDENTS_FAILED;
dispatch({type: pendingAction});
API.patch(`/integration/fees`, updateData)
.then(response => {
dispatch({type: successAction, payload: response.data});
})
.catch(error => {
dispatch({type: failedAction, payload: error.response});
});
};
export const fetchMembersList = (dispatch) => {
dispatch({type: FETCH_MEMBERS_PENDING});
API.get('officeRnD/membersList')