detect and save unscheduled and unlocked incidents
This commit is contained in:
34
client/src/store/actions/integrationActions.js
Normal file
34
client/src/store/actions/integrationActions.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import {
|
||||
FETCH_MAPPINGS_PENDING,
|
||||
FETCH_MAPPINGS_SUCCESS,
|
||||
FETCH_MAPPINGS_FAILED,
|
||||
ADD_NEW_MAPPING_PENDING,
|
||||
ADD_NEW_MAPPING_SUCCESS,
|
||||
ADD_NEW_MAPPING_FAILED,
|
||||
} from "../constants";
|
||||
|
||||
import API from '../../utilities/api';
|
||||
|
||||
export const fetchMappings = (dispatch) => {
|
||||
dispatch({type: FETCH_MAPPINGS_PENDING});
|
||||
API.get('integration/mappings')
|
||||
.then(response => {
|
||||
dispatch({type: FETCH_MAPPINGS_SUCCESS, payload: response.data});
|
||||
})
|
||||
.catch(error => {
|
||||
dispatch({type: FETCH_MAPPINGS_FAILED, payload: error.response});
|
||||
});
|
||||
};
|
||||
|
||||
export const addNewMapping = (dispatch, mapping) => {
|
||||
dispatch({type: ADD_NEW_MAPPING_PENDING});
|
||||
API.post('integration/mappings', {
|
||||
mapping
|
||||
})
|
||||
.then(response => {
|
||||
dispatch({type: ADD_NEW_MAPPING_SUCCESS, payload: response.data});
|
||||
})
|
||||
.catch(error => {
|
||||
dispatch({type: ADD_NEW_MAPPING_FAILED, payload: error.response});
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user