Skip to content

Commit

Permalink
fix: added checks for walletSelectorState and fastAuthWallet in signi…
Browse files Browse the repository at this point in the history
…n file
  • Loading branch information
erditkurteshiSQA committed Jan 9, 2024
1 parent 7ceec39 commit bd16fcd
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/pages/signin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,19 @@ const SignInPage: NextPageWithLayout = () => {
useEffect(() => {
if (vmNear?.selector && searchParams.get('account_id') && searchParams.get('public_key')) {
vmNear.selector
.then((selector: any) => selector.wallet('fast-auth-wallet'))
.then((fastAuthWallet: any) =>
fastAuthWallet.signIn({
contractId: vmNear.config.contractName,
}),
);
.then((selector: any) => {
const walletSelectorState = selector.store.getState();
if (walletSelectorState === 'fast-auth-wallet') {
return selector.wallet('fast-auth-wallet');
}
})
.then((fastAuthWallet: any) => {
if (fastAuthWallet) {
fastAuthWallet.signIn({
contractId: vmNear.config.contractName,
});
}
});
}
}, [searchParams, vmNear]);

Expand Down

0 comments on commit bd16fcd

Please sign in to comment.