Don't call ME_FETCH_SUCCESS twice extraneously

merge-requests/377/merge
Alex Gleason 2021-03-31 13:36:48 -05:00
rodzic 3bc35cf3eb
commit a42ece6df4
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 3 dodań i 5 usunięć

Wyświetl plik

@ -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 });

Wyświetl plik

@ -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));
});;
};