2017-05-16 13:34:00 +02:00
|
|
|
import axios from 'axios';
|
|
|
|
import {apiError} from 'components/errors/actions'
|
|
|
|
|
2018-10-03 17:17:18 +02:00
|
|
|
export const LOAD_CONFIG_SUCCESS = "@config/LOAD_CONFIG_SUCCESS";
|
2017-05-16 13:34:00 +02:00
|
|
|
|
2017-07-04 12:37:16 +02:00
|
|
|
function loadConfigSuccess(config) {
|
2017-05-16 13:34:00 +02:00
|
|
|
return {
|
|
|
|
type: LOAD_CONFIG_SUCCESS,
|
2017-07-04 12:37:16 +02:00
|
|
|
payload: config
|
|
|
|
};
|
2017-05-16 13:34:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export function loadConfig() {
|
|
|
|
return (dispatch) => {
|
2018-10-03 18:10:16 +02:00
|
|
|
axios.get(`/api/v1/config`)
|
2018-10-18 11:50:54 +02:00
|
|
|
.then(
|
|
|
|
({data}) => {
|
|
|
|
dispatch(loadConfigSuccess(data));
|
|
|
|
},
|
|
|
|
(error) => dispatch(apiError(error)));
|
2017-05-16 13:34:00 +02:00
|
|
|
}
|
|
|
|
}
|