fix: note update

This commit is contained in:
Vlad Stan 2022-08-03 10:35:34 +03:00
parent f11a51a4cc
commit f1976e624d
3 changed files with 9 additions and 5 deletions

View File

@ -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})
}
},

View File

@ -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)

View File

@ -99,6 +99,7 @@
@show-address-details="showAddressDetails"
@update:addresses="initUtxos"
@search:tab="searchInTab"
@update:note="updateNoteForAddress"
:inkey="g.user.wallets[0].inkey"
>
</address-list>
@ -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</q-btn
>