Skip to content

Commit

Permalink
Added handling of err.code 2 when site was not approved to get active…
Browse files Browse the repository at this point in the history
… key
  • Loading branch information
piotrwitek committed Apr 26, 2023
1 parent 5830d53 commit 866aa35
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/wallet-service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,21 @@ export const WalletServiceProvider = props => {
);
}, []);

// updated active publicKey when wallet unlocked
useEffect(() => {
getActivePublicKey()
.then(key => {
setActivePublicKey(key);
console.log(key);
})
.catch(err => {
if (err.code === 2) {
setActivePublicKey(null);
}
// no op
});
}, [extensionLoaded,setActivePublicKey]);

// WALLET SUBSCRIPTIONS
useEffect(() => {
if (extensionLoaded === false) {
Expand Down

0 comments on commit 866aa35

Please sign in to comment.