sforkowany z mirror/soapbox
Revert lazy type changes to actions/instance.ts
rodzic
a773c245e8
commit
161cd3d1fc
|
@ -59,7 +59,7 @@ export function fetchInstance() {
|
||||||
return api(getState).get('/api/v1/instance').then(({ data: instance }: { data: Record<string, any> }) => {
|
return api(getState).get('/api/v1/instance').then(({ data: instance }: { data: Record<string, any> }) => {
|
||||||
dispatch({ type: INSTANCE_FETCH_SUCCESS, instance });
|
dispatch({ type: INSTANCE_FETCH_SUCCESS, instance });
|
||||||
if (needsNodeinfo(instance)) {
|
if (needsNodeinfo(instance)) {
|
||||||
dispatch(fetchNodeinfo() as any); // Pleroma < 2.1 backwards compatibility
|
dispatch(fetchNodeinfo()); // Pleroma < 2.1 backwards compatibility
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
@ -73,10 +73,8 @@ export function loadInstance() {
|
||||||
return (dispatch: AppDispatch, getState: () => RootState) => {
|
return (dispatch: AppDispatch, getState: () => RootState) => {
|
||||||
const host = getHost(getState());
|
const host = getHost(getState());
|
||||||
|
|
||||||
if (!host) return new Promise(r => r(null));
|
return dispatch(rememberInstance(host)).finally(() => {
|
||||||
|
return dispatch(fetchInstance());
|
||||||
return dispatch(rememberInstance(host) as any).finally(() => {
|
|
||||||
return dispatch(fetchInstance() as any);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue