Skip to content

Commit

Permalink
Merge pull request #3535 from Expensify/amechler-fix-signout
Browse files Browse the repository at this point in the history
Fix infinite spinner when signing into an account after signing out

(cherry picked from commit fad0d88)
  • Loading branch information
marcaaron authored and roryabraham committed Jun 11, 2021
1 parent 5e9f542 commit a7cfb18
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"react-native-image-picker": "^2.3.3",
"react-native-keyboard-spacer": "^0.4.1",
"react-native-modal": "^11.10.0",
"react-native-onyx": "git+https://github.com/Expensify/react-native-onyx.git#52c254fbc4b96224d2ac087e57ef6efc4210ccc1",
"react-native-onyx": "git+https://github.com/Expensify/react-native-onyx.git#1e82e592032c6d0ede8e40f08beb6be790d149e8",
"react-native-pdf": "^6.2.2",
"react-native-permissions": "^3.0.1",
"react-native-picker-select": "8.0.4",
Expand Down
22 changes: 10 additions & 12 deletions src/libs/actions/Session.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,19 @@ function createAccount(login) {
* Clears the Onyx store and redirects user to the sign in page
*/
function signOut() {
if (credentials && credentials.autoGeneratedLogin) {
// Clean up the login that we created
API.DeleteLogin({
partnerUserID: credentials.autoGeneratedLogin,
partnerName: CONFIG.EXPENSIFY.PARTNER_NAME,
partnerPassword: CONFIG.EXPENSIFY.PARTNER_PASSWORD,
doNotRetry: true,
})
.catch(error => Onyx.merge(ONYXKEYS.SESSION, {error: error.message}));
}
Timing.clearData();
redirectToSignIn();

console.debug('Redirecting to Sign In because signOut() was called');
if (!credentials || !credentials.autoGeneratedLogin) {
return;
}

API.DeleteLogin({
partnerUserID: credentials.autoGeneratedLogin,
partnerName: CONFIG.EXPENSIFY.PARTNER_NAME,
partnerPassword: CONFIG.EXPENSIFY.PARTNER_PASSWORD,
doNotRetry: true,
})
.catch(error => Onyx.merge(ONYXKEYS.SESSION, {error: error.message}));
}

/**
Expand Down

0 comments on commit a7cfb18

Please sign in to comment.