diff --git a/lnbits/extensions/watchonly/static/components/address-list/address-list.js b/lnbits/extensions/watchonly/static/components/address-list/address-list.js index 4f4f00233..ebb8c87f8 100644 --- a/lnbits/extensions/watchonly/static/components/address-list/address-list.js +++ b/lnbits/extensions/watchonly/static/components/address-list/address-list.js @@ -110,6 +110,9 @@ async function addressList(path) { }, searchInTab: function (tab, value) { this.$emit('search:tab', {tab, value}) + }, + updateNoteForAddress: async function (addressData, note) { + this.$emit('update:note', {addressId: addressData.id, note}) } }, diff --git a/lnbits/extensions/watchonly/static/js/index.js b/lnbits/extensions/watchonly/static/js/index.js index 6135ed175..e21c91afb 100644 --- a/lnbits/extensions/watchonly/static/js/index.js +++ b/lnbits/extensions/watchonly/static/js/index.js @@ -98,17 +98,17 @@ const watchOnly = async () => { LNbits.utils.notifyApiError(err) } }, - updateNoteForAddress: async function (addressData, note) { + updateNoteForAddress: async function ({addressId, note}) { try { const wallet = this.g.user.wallets[0] await LNbits.api.request( 'PUT', - `/watchonly/api/v1/address/${addressData.id}`, + `/watchonly/api/v1/address/${addressId}`, wallet.adminkey, - {note: addressData.note} + {note} ) const updatedAddress = - this.addresses.find(a => a.id === addressData.id) || {} + this.addresses.find(a => a.id === addressId) || {} updatedAddress.note = note } catch (err) { LNbits.utils.notifyApiError(err) diff --git a/lnbits/extensions/watchonly/templates/watchonly/index.html b/lnbits/extensions/watchonly/templates/watchonly/index.html index b106dd39c..fd9bf4043 100644 --- a/lnbits/extensions/watchonly/templates/watchonly/index.html +++ b/lnbits/extensions/watchonly/templates/watchonly/index.html @@ -99,6 +99,7 @@ @show-address-details="showAddressDetails" @update:addresses="initUtxos" @search:tab="searchInTab" + @update:note="updateNoteForAddress" :inkey="g.user.wallets[0].inkey" > @@ -200,7 +201,7 @@ outline v-close-popup color="grey" - @click="updateNoteForAddress(currentAddress, addressNote)" + @click="updateNoteForAddress({addressId: currentAddress.id, note: addressNote})" class="q-ml-sm" >Save Note