1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00

36 lines
1.0 KiB
React
Raw Normal View History

2017-05-16 13:34:00 +02:00
import axios from 'axios';
import {apiError} from 'components/errors/actions'
2017-05-23 15:52:19 +02:00
import {loadRejectReasonsSuccess,
loadNoExportReasonsSuccess}
from 'components/routeservers/large-communities/actions';
2017-05-16 13:34:00 +02:00
export const LOAD_CONFIG_SUCCESS = "@birdseye/LOAD_CONFIG_SUCCESS";
function loadConfigSuccess(routes_columns) {
return {
type: LOAD_CONFIG_SUCCESS,
routes_columns: routes_columns
}
}
export function loadConfig() {
return (dispatch) => {
2017-05-22 15:17:40 +02:00
axios.get(`/api/config`)
2017-05-16 13:34:00 +02:00
.then(({data}) => {
dispatch(
2017-05-22 16:44:30 +02:00
loadRejectReasonsSuccess(data.rejection.asn,
data.rejection.reject_id,
data.reject_reasons)
2017-05-16 13:34:00 +02:00
);
2017-05-23 15:52:19 +02:00
dispatch(
loadNoExportReasonsSuccess(
data.config.noexport.asn,
data.config.noexport.noexport_id,
data.config.noexport_reasons)
);
2017-05-22 16:44:30 +02:00
dispatch(loadConfigSuccess(data.routes_columns));
2017-05-16 13:34:00 +02:00
})
.catch(error => dispatch(apiError(error)));
}
}