From 82e026b010e526277a39acac84832436853415f3 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 9 May 2021 10:37:49 -0500 Subject: [PATCH] Fix verify_credentials bug, fixes #638 --- app/soapbox/actions/auth.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/soapbox/actions/auth.js b/app/soapbox/actions/auth.js index 1475f9753..ff4e1390a 100644 --- a/app/soapbox/actions/auth.js +++ b/app/soapbox/actions/auth.js @@ -136,16 +136,15 @@ export function otpVerify(code, mfa_token) { export function verifyCredentials(token) { return (dispatch, getState) => { - const me = getState().get('me'); dispatch({ type: VERIFY_CREDENTIALS_REQUEST }); return baseClient(token).get('/api/v1/accounts/verify_credentials').then(({ data: account }) => { dispatch(importFetchedAccount(account)); dispatch({ type: VERIFY_CREDENTIALS_SUCCESS, token, account }); - if (account.id === me) dispatch(fetchMeSuccess(account)); + if (account.id === getState().get('me')) dispatch(fetchMeSuccess(account)); return account; }).catch(error => { - if (me === null) dispatch(fetchMeFail(error)); + if (getState().get('me') === null) dispatch(fetchMeFail(error)); dispatch({ type: VERIFY_CREDENTIALS_FAIL, token, error }); }); };