From f1976e624ddb68704ceb7a7d773b6b48d6a4eae1 Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Wed, 3 Aug 2022 10:35:34 +0300 Subject: [PATCH] fix: note update --- .../static/components/address-list/address-list.js | 3 +++ lnbits/extensions/watchonly/static/js/index.js | 8 ++++---- .../extensions/watchonly/templates/watchonly/index.html | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) 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 4f4f0023..ebb8c87f 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 6135ed17..e21c91af 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 b106dd39..fd9bf404 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