Use account lookup in fetchAccountByUsername
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
b5b089ac7d
commit
6805e88b69
1 changed files with 9 additions and 1 deletions
|
@ -148,8 +148,16 @@ export function fetchAccountByUsername(username) {
|
||||||
|
|
||||||
const instance = state.get('instance');
|
const instance = state.get('instance');
|
||||||
const features = getFeatures(instance);
|
const features = getFeatures(instance);
|
||||||
|
const me = state.get('me');
|
||||||
|
|
||||||
if (features.accountByUsername) {
|
if (!me && features.accountLookup) {
|
||||||
|
dispatch(accountLookup(username)).then(account => {
|
||||||
|
dispatch(fetchAccountSuccess(account));
|
||||||
|
}).catch(error => {
|
||||||
|
dispatch(fetchAccountFail(null, error));
|
||||||
|
dispatch(importErrorWhileFetchingAccountByUsername(username));
|
||||||
|
});
|
||||||
|
} else if (features.accountByUsername) {
|
||||||
api(getState).get(`/api/v1/accounts/${username}`).then(response => {
|
api(getState).get(`/api/v1/accounts/${username}`).then(response => {
|
||||||
dispatch(fetchRelationships([response.data.id]));
|
dispatch(fetchRelationships([response.data.id]));
|
||||||
dispatch(importFetchedAccount(response.data));
|
dispatch(importFetchedAccount(response.data));
|
||||||
|
|
Loading…
Reference in a new issue