Show error if config fails to parse
This commit is contained in:
parent
b66e4a6886
commit
4be23e5fc7
@ -73,20 +73,20 @@ export function loadConfig() {
|
|||||||
return (dispatch) => {
|
return (dispatch) => {
|
||||||
dispatch(configLoading());
|
dispatch(configLoading());
|
||||||
|
|
||||||
fetch("config.yml", { credentials: 'same-origin' }).then((response) => {
|
fetch("config.yml", { credentials: 'same-origin' })
|
||||||
|
.then((response) => {
|
||||||
if (response.status !== 200) {
|
if (response.status !== 200) {
|
||||||
throw new Error(`Failed to load config.yml (${ response.status })`);
|
throw new Error(`Failed to load config.yml (${ response.status })`);
|
||||||
}
|
}
|
||||||
|
return response.text();
|
||||||
response
|
})
|
||||||
.text()
|
.then(parseConfig)
|
||||||
.then(parseConfig)
|
.then(applyDefaults)
|
||||||
.then(applyDefaults)
|
.then((config) => {
|
||||||
.then((config) => {
|
dispatch(configDidLoad(config));
|
||||||
dispatch(configDidLoad(config));
|
dispatch(authenticateUser());
|
||||||
dispatch(authenticateUser());
|
})
|
||||||
});
|
.catch((err) => {
|
||||||
}).catch((err) => {
|
|
||||||
dispatch(configFailed(err));
|
dispatch(configFailed(err));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user