From 6ba13239c6273262fcc2537aae0e477ae1f0b8ba Mon Sep 17 00:00:00 2001 From: Justin Date: Wed, 1 Jun 2022 13:45:49 -0400 Subject: [PATCH] Return the promise --- app/soapbox/actions/accounts.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/soapbox/actions/accounts.js b/app/soapbox/actions/accounts.js index 4df56417e..56210c1d0 100644 --- a/app/soapbox/actions/accounts.js +++ b/app/soapbox/actions/accounts.js @@ -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)); + }); }; }