From 6a59208297cd100063b7534e6ef35e92b541b585 Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Mon, 7 Jun 2021 22:54:22 +0100 Subject: [PATCH] Fix form reset on LNURLp (#201) Co-authored-by: Tiago Vasconcelos --- lnbits/extensions/lnurlp/lnurl.py | 2 +- lnbits/extensions/lnurlp/static/js/index.js | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lnbits/extensions/lnurlp/lnurl.py b/lnbits/extensions/lnurlp/lnurl.py index 13a5e85a..d4f36e47 100644 --- a/lnbits/extensions/lnurlp/lnurl.py +++ b/lnbits/extensions/lnurlp/lnurl.py @@ -104,4 +104,4 @@ async def api_lnurl_callback(link_id): if success_action: resp["success_action"] = success_action - return jsonify(), HTTPStatus.OK + return jsonify(resp), HTTPStatus.OK diff --git a/lnbits/extensions/lnurlp/static/js/index.js b/lnbits/extensions/lnurlp/static/js/index.js index dbc0df1e..fbf6a60f 100644 --- a/lnbits/extensions/lnurlp/static/js/index.js +++ b/lnbits/extensions/lnurlp/static/js/index.js @@ -62,7 +62,9 @@ new Vue({ LNbits.utils.notifyApiError(err) }) }, - closeFormDialog() {}, + closeFormDialog() { + this.resetFormData() + }, openQrCodeDialog(linkId) { var link = _.findWhere(this.payLinks, {id: linkId}) if (link.currency) this.updateFiatRate(link.currency) @@ -116,6 +118,13 @@ new Vue({ this.createPayLink(wallet, data) } }, + resetFormData() { + this.formDialog = { + show: false, + fixedAmount: true, + data: {} + } + }, updatePayLink(wallet, data) { let values = _.omit( _.pick( @@ -147,6 +156,7 @@ new Vue({ this.payLinks = _.reject(this.payLinks, obj => obj.id === data.id) this.payLinks.push(mapPayLink(response.data)) this.formDialog.show = false + this.resetFormData() }) .catch(err => { LNbits.utils.notifyApiError(err) @@ -158,6 +168,7 @@ new Vue({ .then(response => { this.payLinks.push(mapPayLink(response.data)) this.formDialog.show = false + this.resetFormData() }) .catch(err => { LNbits.utils.notifyApiError(err)