1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00
Matthias Hannig 58727c96d7 changed API
2017-05-22 16:44:30 +02:00

28 lines
786 B
JavaScript

import axios from 'axios';
import {apiError} from 'components/errors/actions'
import {loadRejectReasonsSuccess} from 'components/routeservers/actions';
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) => {
axios.get(`/api/config`)
.then(({data}) => {
dispatch(
loadRejectReasonsSuccess(data.rejection.asn,
data.rejection.reject_id,
data.reject_reasons)
);
dispatch(loadConfigSuccess(data.routes_columns));
})
.catch(error => dispatch(apiError(error)));
}
}