Fix form reset on LNURLp (#201)

Co-authored-by: Tiago Vasconcelos <tvasconcelos@gmail.com>
This commit is contained in:
Tiago Vasconcelos 2021-06-07 22:54:22 +01:00 committed by GitHub
parent 5fbd1f08c4
commit 6a59208297
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -104,4 +104,4 @@ async def api_lnurl_callback(link_id):
if success_action: if success_action:
resp["success_action"] = success_action resp["success_action"] = success_action
return jsonify(), HTTPStatus.OK return jsonify(resp), HTTPStatus.OK

View File

@ -62,7 +62,9 @@ new Vue({
LNbits.utils.notifyApiError(err) LNbits.utils.notifyApiError(err)
}) })
}, },
closeFormDialog() {}, closeFormDialog() {
this.resetFormData()
},
openQrCodeDialog(linkId) { openQrCodeDialog(linkId) {
var link = _.findWhere(this.payLinks, {id: linkId}) var link = _.findWhere(this.payLinks, {id: linkId})
if (link.currency) this.updateFiatRate(link.currency) if (link.currency) this.updateFiatRate(link.currency)
@ -116,6 +118,13 @@ new Vue({
this.createPayLink(wallet, data) this.createPayLink(wallet, data)
} }
}, },
resetFormData() {
this.formDialog = {
show: false,
fixedAmount: true,
data: {}
}
},
updatePayLink(wallet, data) { updatePayLink(wallet, data) {
let values = _.omit( let values = _.omit(
_.pick( _.pick(
@ -147,6 +156,7 @@ new Vue({
this.payLinks = _.reject(this.payLinks, obj => obj.id === data.id) this.payLinks = _.reject(this.payLinks, obj => obj.id === data.id)
this.payLinks.push(mapPayLink(response.data)) this.payLinks.push(mapPayLink(response.data))
this.formDialog.show = false this.formDialog.show = false
this.resetFormData()
}) })
.catch(err => { .catch(err => {
LNbits.utils.notifyApiError(err) LNbits.utils.notifyApiError(err)
@ -158,6 +168,7 @@ new Vue({
.then(response => { .then(response => {
this.payLinks.push(mapPayLink(response.data)) this.payLinks.push(mapPayLink(response.data))
this.formDialog.show = false this.formDialog.show = false
this.resetFormData()
}) })
.catch(err => { .catch(err => {
LNbits.utils.notifyApiError(err) LNbits.utils.notifyApiError(err)