show incidents for selected member and selected dates

This commit is contained in:
Bilal Catic
2019-06-19 00:23:40 +02:00
parent 0ccd2ff55c
commit 4166ff7a48
8 changed files with 200 additions and 5 deletions

View File

@@ -8,6 +8,12 @@ import {
FETCH_INCIDENTS_PENDING,
FETCH_INCIDENTS_SUCCESS,
FETCH_INCIDENTS_FAILED,
FETCH_MEMBERS_PENDING,
FETCH_MEMBERS_SUCCESS,
FETCH_MEMBERS_FAILED,
FETCH_MEMBER_INCIDENTS_PENDING,
FETCH_MEMBER_INCIDENTS_SUCCESS,
FETCH_MEMBER_INCIDENTS_FAILED,
} from '../constants';
import API from '../../utilities/api';
@@ -48,3 +54,27 @@ export const fetchIncidents = (dispatch, dateRange) => {
dispatch({type: FETCH_INCIDENTS_FAILED, payload: error.response});
});
};
export const fetchMembersList = (dispatch) => {
dispatch({type: FETCH_MEMBERS_PENDING});
API.get('officeRnD/membersList')
.then(response => {
dispatch({type: FETCH_MEMBERS_SUCCESS, payload: response.data});
})
.catch(error => {
dispatch({type: FETCH_MEMBERS_FAILED, payload: error.response});
});
};
export const fetchMemberIncidents = (dispatch, memberId, dateRange) => {
const { startDate, endDate } = dateRange;
dispatch({type: FETCH_MEMBER_INCIDENTS_PENDING});
API.get(`integration/report/member/${memberId}/${startDate}/${endDate}`)
.then(response => {
dispatch({type: FETCH_MEMBER_INCIDENTS_SUCCESS, payload: response.data});
})
.catch(error => {
dispatch({type: FETCH_MEMBER_INCIDENTS_FAILED, payload: error.response});
});
};