You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
674 B
28 lines
674 B
import api from '../api';
|
|
|
|
export const RULES_FETCH_REQUEST = 'RULES_FETCH_REQUEST';
|
|
export const RULES_FETCH_SUCCESS = 'RULES_FETCH_SUCCESS';
|
|
export const RULES_FETCH_FAIL = 'RULES_FETCH_FAIL';
|
|
|
|
export const fetchRules = () => (dispatch, getState) => {
|
|
dispatch(fetchRulesRequest());
|
|
|
|
api(getState)
|
|
.get('/api/v1/instance').then(({ data }) => dispatch(fetchRulesSuccess(data.rules)))
|
|
.catch(err => dispatch(fetchRulesFail(err)));
|
|
};
|
|
|
|
const fetchRulesRequest = () => ({
|
|
type: RULES_FETCH_REQUEST,
|
|
});
|
|
|
|
const fetchRulesSuccess = rules => ({
|
|
type: RULES_FETCH_SUCCESS,
|
|
rules,
|
|
});
|
|
|
|
const fetchRulesFail = error => ({
|
|
type: RULES_FETCH_FAIL,
|
|
error,
|
|
});
|