Skip to content

Commit f1ef337

Browse files
authored
Merge pull request #52 from ankur325/Legacy-Wallet-Exporter
Fix defect for legacy wallet
2 parents 5263ad8 + 526dd18 commit f1ef337

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dcl-ui",
3-
"version": "1.0.15",
3+
"version": "1.0.16",
44
"description": "A Vuejs based application for managing CSA Distributed Compliance Ledger",
55
"author": "Comcast Inc.",
66
"private": true,

src/views/Tools/LegacyWallet.vue

+21
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,30 @@ export default {
132132
const deleteWallet = () => {
133133
const index = wallets.value.findIndex(w => w.name === selectedWallet.value.name);
134134
if (index !== -1) {
135+
// Check if the wallet being deleted is the lastWallet
136+
const lastWalletName = localStorage.getItem('lastWallet');
137+
const isLastWallet = lastWalletName === selectedWallet.value.name;
138+
139+
// Remove the wallet
135140
wallets.value.splice(index, 1);
141+
142+
// Update wallets in localStorage
136143
localStorage.setItem('wallets', JSON.stringify(wallets.value));
144+
145+
// Update lastWallet if necessary
146+
if (isLastWallet) {
147+
if (wallets.value.length > 0) {
148+
// If there are remaining wallets, set lastWallet to the next one (or the first one if we deleted the last wallet)
149+
const nextIndex = index < wallets.value.length ? index : 0;
150+
const nextWalletName = wallets.value[nextIndex].name;
151+
localStorage.setItem('lastWallet', nextWalletName);
152+
} else {
153+
// If no wallets remain, remove lastWallet from localStorage
154+
localStorage.removeItem('lastWallet');
155+
}
156+
}
137157
}
158+
138159
deleteDialogVisible.value = false;
139160
selectedWallet.value = null;
140161
};

0 commit comments

Comments
 (0)