fetch and display door lock incidents on frontend
This commit is contained in:
@@ -5,7 +5,10 @@ import {
|
||||
ADD_NEW_MAPPING_PENDING,
|
||||
ADD_NEW_MAPPING_SUCCESS,
|
||||
ADD_NEW_MAPPING_FAILED,
|
||||
} from "../constants";
|
||||
FETCH_INCIDENTS_PENDING,
|
||||
FETCH_INCIDENTS_SUCCESS,
|
||||
FETCH_INCIDENTS_FAILED,
|
||||
} from '../constants';
|
||||
|
||||
import API from '../../utilities/api';
|
||||
|
||||
@@ -32,3 +35,14 @@ export const addNewMapping = (dispatch, mapping) => {
|
||||
dispatch({type: ADD_NEW_MAPPING_FAILED, payload: error.response});
|
||||
});
|
||||
};
|
||||
|
||||
export const fetchIncidents = (dispatch) => {
|
||||
dispatch({type: FETCH_INCIDENTS_PENDING});
|
||||
API.get('integration/report/allIncidents')
|
||||
.then(response => {
|
||||
dispatch({type: FETCH_INCIDENTS_SUCCESS, payload: response.data});
|
||||
})
|
||||
.catch(error => {
|
||||
dispatch({type: FETCH_INCIDENTS_FAILED, payload: error.response});
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user