Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch wallet abort connection error #551

Merged
merged 3 commits into from
Aug 6, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ export default new Vuex.Store({
commit('setWarning', null)
}
}
});
});
10 changes: 9 additions & 1 deletion src/utils/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export class Wallet {

static getLastUsedAccount() {
const accounts = localStorage.getItem('beacon:accounts');
if(!accounts) return null

const communicationPeersDapp = localStorage.getItem('beacon:communication-peers-dapp');
const postmessagePeersDapp = localStorage.getItem('beacon:postmessage-peers-dapp');
let peers = [];
Expand All @@ -74,7 +76,6 @@ export class Wallet {
peers = [...peers, ...JSON.parse(postmessagePeersDapp)]
}

if(!accounts) return null
const parsedAccounts = JSON.parse(accounts);
const connectionTimes = parsedAccounts.map(item => item.connectedAt);
const recentConnectionTime = Math.max(...connectionTimes);
Expand Down Expand Up @@ -115,6 +116,13 @@ export class Wallet {
Wallet.isPermissionGiven = true;
resolve();
})
.catch(e => {
if (e.title.toUpperCase() === 'ABORTED') {
GusevPM marked this conversation as resolved.
Show resolved Hide resolved
resolve();
} else {
reject();
}
})
.finally(() => reject())
})
}
Expand Down