Return the promise

environments/review-add-accoun-5o034k/deployments/144
Justin 2 years ago
parent 190d94a438
commit 6ba13239c6

@ -136,17 +136,20 @@ export function fetchAccount(id) {
const account = getState().getIn(['accounts', id]);
if (account && !account.get('should_refetch')) {
return;
return null;
}
dispatch(fetchAccountRequest(id));
api(getState).get(`/api/v1/accounts/${id}`).then(response => {
dispatch(importFetchedAccount(response.data));
dispatch(fetchAccountSuccess(response.data));
}).catch(error => {
dispatch(fetchAccountFail(id, error));
});
return api(getState)
.get(`/api/v1/accounts/${id}`)
.then(response => {
dispatch(importFetchedAccount(response.data));
dispatch(fetchAccountSuccess(response.data));
})
.catch(error => {
dispatch(fetchAccountFail(id, error));
});
};
}

Loading…
Cancel
Save