Refactor fetchSoapboxConfig()
This commit is contained in:
parent
b7a6d7d261
commit
0668cc786f
1 changed files with 12 additions and 10 deletions
|
@ -9,18 +9,20 @@ export function fetchSoapboxConfig() {
|
||||||
if (response.data.soapbox_fe) {
|
if (response.data.soapbox_fe) {
|
||||||
dispatch(importSoapboxConfig(response.data.soapbox_fe));
|
dispatch(importSoapboxConfig(response.data.soapbox_fe));
|
||||||
} else {
|
} else {
|
||||||
api(getState).get('/instance/soapbox.json').then(response => {
|
dispatch(fetchSoapboxJson());
|
||||||
dispatch(importSoapboxConfig(response.data));
|
|
||||||
}).catch(error => {
|
|
||||||
dispatch(soapboxConfigFail(error));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
api(getState).get('/instance/soapbox.json').then(response => {
|
dispatch(fetchSoapboxJson());
|
||||||
dispatch(importSoapboxConfig(response.data));
|
});
|
||||||
}).catch(error => {
|
};
|
||||||
dispatch(soapboxConfigFail(error));
|
}
|
||||||
});
|
|
||||||
|
export function fetchSoapboxJson() {
|
||||||
|
return (dispatch, getState) => {
|
||||||
|
api(getState).get('/instance/soapbox.json').then(response => {
|
||||||
|
dispatch(importSoapboxConfig(response.data));
|
||||||
|
}).catch(error => {
|
||||||
|
dispatch(soapboxConfigFail(error));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue