Skip to content

Commit

Permalink
throw error if user closes the modal
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanyapotti committed Dec 22, 2023
1 parent fbca245 commit e82c500
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/modal/src/modalManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ export class Web3Auth extends Web3AuthNoModal implements IWeb3AuthModal {
this.once(ADAPTER_EVENTS.ERRORED, (err: unknown) => {
return reject(err);
});
this.once(LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, (visibility: boolean) => {
// modal is closed but user is not connected to any wallet.
if (!visibility && this.status !== ADAPTER_STATUS.CONNECTED) {
return reject(new Error("User closed the modal"));
}
});
});
}

Expand Down

0 comments on commit e82c500

Please sign in to comment.