Don't call ME_FETCH_SUCCESS twice extraneously
This commit is contained in:
parent
3bc35cf3eb
commit
a42ece6df4
2 changed files with 3 additions and 5 deletions
|
@ -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 });
|
||||
|
|
|
@ -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));
|
||||
});;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue