actions/soapbox: ensure we wait til the bitter end
This commit is contained in:
parent
bbefc800c0
commit
5b9537ca07
|
@ -64,8 +64,9 @@ export function fetchSoapboxConfig(host) {
|
||||||
return dispatch(fetchFrontendConfigurations()).then(data => {
|
return dispatch(fetchFrontendConfigurations()).then(data => {
|
||||||
if (data.soapbox_fe) {
|
if (data.soapbox_fe) {
|
||||||
dispatch(importSoapboxConfig(data.soapbox_fe, host));
|
dispatch(importSoapboxConfig(data.soapbox_fe, host));
|
||||||
|
return data.soapbox_fe;
|
||||||
} else {
|
} else {
|
||||||
dispatch(fetchSoapboxJson(host));
|
return dispatch(fetchSoapboxJson(host));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -79,7 +80,7 @@ export function loadSoapboxConfig() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const host = getHost(getState());
|
const host = getHost(getState());
|
||||||
|
|
||||||
return dispatch(rememberSoapboxConfig(host)).finally(() => {
|
return dispatch(rememberSoapboxConfig(host)).then(() => {
|
||||||
return dispatch(fetchSoapboxConfig(host));
|
return dispatch(fetchSoapboxConfig(host));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -87,9 +88,10 @@ export function loadSoapboxConfig() {
|
||||||
|
|
||||||
export function fetchSoapboxJson(host) {
|
export function fetchSoapboxJson(host) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
staticClient.get('/instance/soapbox.json').then(({ data }) => {
|
return staticClient.get('/instance/soapbox.json').then(({ data }) => {
|
||||||
if (!isObject(data)) throw 'soapbox.json failed';
|
if (!isObject(data)) throw 'soapbox.json failed';
|
||||||
dispatch(importSoapboxConfig(data, host));
|
dispatch(importSoapboxConfig(data, host));
|
||||||
|
return data;
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(soapboxConfigFail(error, host));
|
dispatch(soapboxConfigFail(error, host));
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue