[bugfix] account for data structure change in instance API fallback (#63)
Reviewed-on: https://codeberg.org/superseriousbusiness/masto-fe-standalone/pulls/63 Co-authored-by: Sqx. Flann <fl4nn+codeberg@opensuse.org> Co-committed-by: Sqx. Flann <fl4nn+codeberg@opensuse.org>
This commit is contained in:
@@ -20,12 +20,12 @@ export const fetchServer = () => (dispatch, getState) => {
|
||||
try {
|
||||
api(getState)
|
||||
.get('/api/v2/instance').then({ data });
|
||||
if (data.contact.account) dispatch(importFetchedAccount(data.contact.account));
|
||||
dispatch(fetchServerSuccess(data));
|
||||
if (data.contact.account) dispatch(importFetchedAccount(data.contact.account));
|
||||
dispatch(fetchServerSuccess(data));
|
||||
} catch (e) {
|
||||
api(getState)
|
||||
.get('/api/v1/instance').then(({ data }) => {
|
||||
if (data.contact.account) dispatch(importFetchedAccount(data.contact.account));
|
||||
if (data.contact_account) dispatch(importFetchedAccount(data.contact_account));
|
||||
dispatch(fetchServerSuccess(data));
|
||||
}).catch(err => dispatch(fetchServerFail(err)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user