Standalone: fallback to limited featureset when authenticated fetch is enabled

merge-requests/702/head
Alex Gleason 2021-08-31 09:02:43 -07:00
rodzic 777c975693
commit 474d67f591
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 11 dodań i 2 usunięć

Wyświetl plik

@ -13,12 +13,21 @@ import { authLoggedIn, verifyCredentials, switchAccount } from 'soapbox/actions/
import { parseBaseURL } from 'soapbox/utils/auth';
import { getFeatures } from 'soapbox/utils/features';
import sourceCode from 'soapbox/utils/code';
import { fromJS } from 'immutable';
import { Map as ImmutableMap, fromJS } from 'immutable';
const fetchExternalInstance = baseURL => {
return baseClient(null, baseURL)
.get('/api/v1/instance')
.then(({ data: instance }) => fromJS(instance));
.then(({ data: instance }) => fromJS(instance))
.catch(error => {
if (error.response.status === 401) {
// Authenticated fetch is enabled.
// Continue with a limited featureset.
return ImmutableMap({ version: '0.0.0' });
} else {
throw error;
}
});
};
export function createAppAndRedirect(host) {