Don't call ME_FETCH_SUCCESS twice extraneously

This commit is contained in:
Alex Gleason 2021-03-31 13:36:48 -05:00
parent 3bc35cf3eb
commit a42ece6df4
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 3 additions and 5 deletions

View file

@ -2,7 +2,7 @@ import api from '../api';
import { importFetchedAccount } from './importer'; import { importFetchedAccount } from './importer';
import snackbar from 'soapbox/actions/snackbar'; import snackbar from 'soapbox/actions/snackbar';
import { createAccount } from 'soapbox/actions/accounts'; 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'; export const SWITCH_ACCOUNT = 'SWITCH_ACCOUNT';
@ -149,7 +149,7 @@ export function verifyCredentials(token) {
return api(getState).request(request).then(({ data: account }) => { return api(getState).request(request).then(({ data: account }) => {
dispatch(importFetchedAccount(account)); dispatch(importFetchedAccount(account));
dispatch({ type: VERIFY_CREDENTIALS_SUCCESS, token, 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; return account;
}).catch(error => { }).catch(error => {
dispatch({ type: VERIFY_CREDENTIALS_FAIL, token, error }); dispatch({ type: VERIFY_CREDENTIALS_FAIL, token, error });

View file

@ -25,9 +25,7 @@ export function fetchMe() {
}; };
dispatch(fetchMeRequest()); dispatch(fetchMeRequest());
return dispatch(verifyCredentials(token)).then(account => { return dispatch(verifyCredentials(token)).catch(error => {
dispatch(fetchMeSuccess(account));
}).catch(error => {
dispatch(fetchMeFail(error)); dispatch(fetchMeFail(error));
});; });;
}; };