fetchMe: don't await verify_credentials if cached

This commit is contained in:
Alex Gleason 2022-05-22 12:53:13 -05:00
parent 7c3d0c821b
commit 4992862943
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 6 additions and 3 deletions

View File

@ -207,9 +207,12 @@ export function rememberAuthAccount(accountUrl) {
export function loadCredentials(token, accountUrl) {
return (dispatch, getState) => {
return dispatch(rememberAuthAccount(accountUrl)).finally(() => {
return dispatch(verifyCredentials(token, accountUrl));
});
return dispatch(rememberAuthAccount(accountUrl))
.then(account => account)
.then(() => {
dispatch(verifyCredentials(token, accountUrl));
})
.catch(error => dispatch(verifyCredentials(token, accountUrl)));
};
}