Fix verify_credentials bug, fixes #638

merge-requests/495/head
Alex Gleason 2021-05-09 10:37:49 -05:00
rodzic aa575b1010
commit 82e026b010
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 2 dodań i 3 usunięć

Wyświetl plik

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