From a42ece6df40526913444cb2861ddaa5149584c8e Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 31 Mar 2021 13:36:48 -0500 Subject: [PATCH] Don't call ME_FETCH_SUCCESS twice extraneously --- app/soapbox/actions/auth.js | 4 ++-- app/soapbox/actions/me.js | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/soapbox/actions/auth.js b/app/soapbox/actions/auth.js index bc714be39..5d4d4529d 100644 --- a/app/soapbox/actions/auth.js +++ b/app/soapbox/actions/auth.js @@ -2,7 +2,7 @@ import api from '../api'; import { importFetchedAccount } from './importer'; import snackbar from 'soapbox/actions/snackbar'; import { createAccount } from 'soapbox/actions/accounts'; -import { ME_FETCH_SUCCESS } from 'soapbox/actions/me'; +import { fetchMeSuccess } from 'soapbox/actions/me'; export const SWITCH_ACCOUNT = 'SWITCH_ACCOUNT'; @@ -149,7 +149,7 @@ export function verifyCredentials(token) { return api(getState).request(request).then(({ data: account }) => { dispatch(importFetchedAccount(account)); dispatch({ type: VERIFY_CREDENTIALS_SUCCESS, token, account }); - if (account.id === getState().get('me')) dispatch({ type: ME_FETCH_SUCCESS, me: account }); + if (account.id === getState().get('me')) dispatch(fetchMeSuccess(account)); return account; }).catch(error => { dispatch({ type: VERIFY_CREDENTIALS_FAIL, token, error }); diff --git a/app/soapbox/actions/me.js b/app/soapbox/actions/me.js index 497e08b94..602334bd0 100644 --- a/app/soapbox/actions/me.js +++ b/app/soapbox/actions/me.js @@ -25,9 +25,7 @@ export function fetchMe() { }; dispatch(fetchMeRequest()); - return dispatch(verifyCredentials(token)).then(account => { - dispatch(fetchMeSuccess(account)); - }).catch(error => { + return dispatch(verifyCredentials(token)).catch(error => { dispatch(fetchMeFail(error)); });; };