Fix webhook (#12)

* refactor html
* don't exclude values on update
This commit is contained in:
Tiago Vasconcelos 2023-09-24 19:18:36 +01:00 committed by GitHub
commit ab6b53668e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 102 additions and 299 deletions

View file

@ -116,7 +116,6 @@ new Vue({
if (this.formDialog.fixedAmount) data.max = data.min
if (data.currency === 'satoshis') data.currency = null
if (isNaN(parseInt(data.comment_chars))) data.comment_chars = 0
if (data.id) {
this.updatePayLink(wallet, data)
} else {
@ -131,33 +130,12 @@ new Vue({
}
},
updatePayLink(wallet, data) {
let values = _.omit(
_.pick(
data,
'description',
'min',
'max',
'webhook_url',
'success_text',
'success_url',
'comment_chars',
'currency',
'username',
'zaps'
),
(value, key) =>
(key === 'webhook_url' ||
key === 'success_text' ||
key === 'success_url') &&
(value === null || value === '')
)
LNbits.api
.request(
'PUT',
'/lnurlp/api/v1/links/' + data.id,
wallet.adminkey,
values
data
)
.then(response => {
this.payLinks = _.reject(this.payLinks, obj => obj.id === data.id)