Refactor fetchSoapboxConfig()

preload
Alex Gleason 2020-08-23 15:32:44 -05:00
rodzic b7a6d7d261
commit 0668cc786f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 12 dodań i 10 usunięć

Wyświetl plik

@ -9,18 +9,20 @@ export function fetchSoapboxConfig() {
if (response.data.soapbox_fe) {
dispatch(importSoapboxConfig(response.data.soapbox_fe));
} else {
api(getState).get('/instance/soapbox.json').then(response => {
dispatch(importSoapboxConfig(response.data));
}).catch(error => {
dispatch(soapboxConfigFail(error));
});
dispatch(fetchSoapboxJson());
}
}).catch(error => {
api(getState).get('/instance/soapbox.json').then(response => {
dispatch(importSoapboxConfig(response.data));
}).catch(error => {
dispatch(soapboxConfigFail(error));
});
dispatch(fetchSoapboxJson());
});
};
}
export function fetchSoapboxJson() {
return (dispatch, getState) => {
api(getState).get('/instance/soapbox.json').then(response => {
dispatch(importSoapboxConfig(response.data));
}).catch(error => {
dispatch(soapboxConfigFail(error));
});
};
}