2020-04-01 12:38:08 -07:00
|
|
|
import api from '../api';
|
|
|
|
|
|
|
|
export const SOAPBOX_CONFIG_IMPORT = 'SOAPBOX_CONFIG_IMPORT';
|
|
|
|
export const SOAPBOX_CONFIG_FAIL = 'SOAPBOX_CONFIG_FAIL';
|
|
|
|
|
|
|
|
export function fetchSoapboxConfig() {
|
|
|
|
return (dispatch, getState) => {
|
2020-04-14 11:44:40 -07:00
|
|
|
api(getState).get('/soapbox/soapbox.json').then(response => {
|
2020-04-01 12:38:08 -07:00
|
|
|
dispatch(importSoapboxConfig(response.data));
|
|
|
|
}).catch(error => {
|
|
|
|
dispatch(soapboxConfigFail(error));
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function importSoapboxConfig(soapboxConfig) {
|
|
|
|
return {
|
|
|
|
type: SOAPBOX_CONFIG_IMPORT,
|
2020-04-14 11:44:40 -07:00
|
|
|
soapboxConfig,
|
2020-04-01 12:38:08 -07:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function soapboxConfigFail(error) {
|
|
|
|
return {
|
|
|
|
type: SOAPBOX_CONFIG_FAIL,
|
|
|
|
error,
|
|
|
|
skipAlert: true,
|
|
|
|
};
|
|
|
|
};
|