diff --git a/templates/cashu/wallet.html b/templates/cashu/wallet.html
index 9638f347e..4336b173a 100644
--- a/templates/cashu/wallet.html
+++ b/templates/cashu/wallet.html
@@ -2721,7 +2721,23 @@ page_container %}
this.tab = 'settings'
}
},
-
+ registerLocalStorageSyncHook: function () {
+ // makes sure that local storage stays up to date
+ // in multiple tabs of the same window
+ window.addEventListener('storage', e => {
+ console.log(`Key Changed: ${e.key}`)
+ console.log(`New Value: ${e.newValue}`)
+ localStorage.setItem(e.key, e.newValue)
+ // if these were the proofs, reload them
+ if (e.key == 'cashu.proofs') {
+ this.proofs = JSON.parse(localStorage.getItem('cashu.proofs'))
+ }
+ // if these were the activeMintUrl, reload
+ if (e.key == 'cashu.activeMintURL') {
+ this.activateMint(e.newValue)
+ }
+ })
+ },
notifySuccess: async function (message, position = 'top') {
this.$q.notify({
timeout: 5000,
@@ -2981,6 +2997,9 @@ page_container %}
await this.activateMint(startupMintUrl)
}
+ // Local storage sync hook
+ this.registerLocalStorageSyncHook()
+
// PWA install hook
this.registerPWAEventHook()