Skip to content

Commit

Permalink
preserve personal details
Browse files Browse the repository at this point in the history
  • Loading branch information
rushatgabhane committed Jul 16, 2024
1 parent c4da238 commit dcddaa2
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/libs/actions/Session/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import * as ReportUtils from '@libs/ReportUtils';
import * as SessionUtils from '@libs/SessionUtils';
import Timers from '@libs/Timers';
import {hideContextMenu} from '@pages/home/report/ContextMenu/ReportActionContextMenu';
import {openApp} from '@userActions/App';
import {KEYS_TO_PRESERVE, openApp} from '@userActions/App';
import * as Device from '@userActions/Device';
import * as PriorityMode from '@userActions/PriorityMode';
import redirectToSignIn from '@userActions/SignInRedirect';
Expand Down Expand Up @@ -950,14 +950,18 @@ function validateTwoFactorAuth(twoFactorAuthCode: string) {
return;
}

// Update authToken in Onyx and in our local variables so that API requests will use the new authToken
updateSessionAuthTokens(response.authToken, response.encryptedAuthToken);
const keysToPreserveWithPrivatePersonalDetails = [...KEYS_TO_PRESERVE, ONYXKEYS.PRIVATE_PERSONAL_DETAILS];
Onyx.clear(keysToPreserveWithPrivatePersonalDetails).then(() => {
// Update authToken in Onyx and in our local variables so that API requests will use the new authToken
updateSessionAuthTokens(response.authToken, response.encryptedAuthToken);

// Note: It is important to manually set the authToken that is in the store here since
// reconnectApp will immediate post and use the local authToken. Onyx updates subscribers lately so it is not
// enough to do the updateSessionAuthTokens() call above.
NetworkStore.setAuthToken(response.authToken ?? null);
openApp();
// Note: It is important to manually set the authToken that is in the store here since
// reconnectApp will immediate post and use the local authToken. Onyx updates subscribers lately so it is not
// enough to do the updateSessionAuthTokens() call above.
NetworkStore.setAuthToken(response.authToken ?? null);

openApp();
});
});
}

Expand Down

0 comments on commit dcddaa2

Please sign in to comment.