diff --git a/src/components/WelcomeDialog.vue b/src/components/WelcomeDialog.vue index 6ce579e7..ede51923 100644 --- a/src/components/WelcomeDialog.vue +++ b/src/components/WelcomeDialog.vue @@ -1,5 +1,5 @@ + diff --git a/src/pages/WalletPage.vue b/src/pages/WalletPage.vue index dac77653..21d0168a 100644 --- a/src/pages/WalletPage.vue +++ b/src/pages/WalletPage.vue @@ -1112,6 +1112,11 @@ export default { this.welcomeDialog.show = false; // switch to settings tab this.setTab("settings"); + + // if a wallet has been restored the "cashu.activeMintUrl" is not null + if (!!localStorage.getItem("cashu.activeMintUrl")) { + window.location.reload(); + } }, setTab: function (to) { this.tab = to; diff --git a/src/stores/mints.js b/src/stores/mints.js index cda8ccb1..b021719a 100644 --- a/src/stores/mints.js +++ b/src/stores/mints.js @@ -168,6 +168,26 @@ export const useMintsStore = defineStore("mints", { } notifySuccess("Mint removed."); }, + restoreFromBackup: function(backup) { + if(!backup || !backup["cashu.welcomeDialogSeen"]) + { + notifyError("Unrecognized Backup Format!"); + } + else + { + localStorage.setItem("cashu.welcomeDialogSeen", backup["cashu.welcomeDialogSeen"]); + localStorage.setItem("cashu.theme", backup["cashu.theme"]); + localStorage.setItem("cashu.mints", backup["cashu.mints"]); + localStorage.setItem("cashu.keysets", backup["cashu.keysets"]); + localStorage.setItem("cashu.keys", backup["cashu.keys"]); + localStorage.setItem("cashu.proofs", backup["cashu.proofs"]); + localStorage.setItem("cashu.historyTokens", backup["cashu.historyTokens"]); + localStorage.setItem("cashu.activeMintUrl", backup["cashu.activeMintUrl"]); + localStorage.setItem("cashu.activeProofs", backup["cashu.activeProofs"]); + + notifySuccess("Backup Successfully Restored!"); + } + }, assertMintError: function (response, verbose = true) { if (response.error != null) { if (verbose) {