Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
war-in committed Jan 7, 2025
1 parent f993b3b commit cf0e4b3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
22 changes: 14 additions & 8 deletions src/libs/actions/Delegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ function connect(email: string) {
Onyx.update(failureData);
return;
}
if (!activePolicyID) {
Log.alert('[Delegate] Unable to access activePolicyID');
Onyx.update(failureData);
return;
}
const restrictedToken = response.restrictedToken;
const policyID = activePolicyID;

return SequentialQueue.waitForIdle()
.then(() => Onyx.clear(KEYS_TO_PRESERVE_DELEGATE_ACCESS))
.then(() => {
Expand All @@ -148,9 +156,7 @@ function connect(email: string) {

NetworkStore.setAuthToken(response?.restrictedToken ?? null);
confirmReadyToOpenApp();
openApp();

NativeModules.HybridAppModule.switchAccount(email, response?.restrictedToken ?? '', activePolicyID ?? '', String(previousAccountID));
openApp().then(() => NativeModules.HybridAppModule.switchAccount(email, restrictedToken, policyID, String(previousAccountID)));
});
})
.catch((error) => {
Expand Down Expand Up @@ -210,6 +216,8 @@ function disconnect() {
return;
}

const requesterEmail = response.requesterEmail;
const authToken = response.authToken;
return SequentialQueue.waitForIdle()
.then(() => Onyx.clear(KEYS_TO_PRESERVE_DELEGATE_ACCESS))
.then(() => {
Expand All @@ -220,8 +228,8 @@ function disconnect() {
Onyx.set(ONYXKEYS.SESSION, {
...stashedSession,
accountID: response.requesterID,
email: response.requesterEmail,
authToken: response.authToken,
email: requesterEmail,
authToken,
encryptedAuthToken: response.encryptedAuthToken,
});
Onyx.set(ONYXKEYS.STASHED_CREDENTIALS, {});
Expand All @@ -230,9 +238,7 @@ function disconnect() {
NetworkStore.setAuthToken(response?.authToken ?? null);

confirmReadyToOpenApp();
openApp().then(() => {
NativeModules.HybridAppModule.switchAccount(response.requesterEmail ?? '', response.authToken ?? '', '', '');
});
openApp().then(() => NativeModules.HybridAppModule.switchAccount(requesterEmail, authToken, '', ''));
});
})
.catch((error) => {
Expand Down
1 change: 0 additions & 1 deletion src/libs/actions/Session/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,6 @@ function signInAfterTransitionFromOldDot(transitionURL: string) {
isSingleNewDotEntry,
primaryLogin,
oldDotOriginalAccountEmail,
oldDotOriginalAccountID,
} = Object.fromEntries(
queryParams.split('&').map((param) => {
const [key, value] = param.split('=');
Expand Down

0 comments on commit cf0e4b3

Please sign in to comment.