diff --git a/src/components/Bar.vue b/src/components/Bar.vue
deleted file mode 100644
index ca8c9b8..0000000
--- a/src/components/Bar.vue
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
+
{{ paymentDetails.message }}
+{{ parse.data.request }}
@@ -142,6 +166,11 @@ export default { }, paymentChecker: null, }, + paymentDetails: { + isPayed: false, + message: '...', + details: '', + }, receive: { show: false, status: 'pending', @@ -178,6 +207,9 @@ export default { showErrorDetais: function () { return this.currentView === 'error' }, + showPaymentStatus: function () { + return this.currentView === 'paymentStatus' + }, }, filters: { msatoshiFormat: function (value) { @@ -273,11 +305,8 @@ export default { this.balance = Math.round(response.data.balance / 1000) }, payInvoice: async function () { - const dismissPaymentMsg = this.$q.notify({ - timeout: 0, - message: 'Processing payment...', - }) try { + this.showPaymentInProgressCard() const response = await lnbitsApi(this.serverUrl).payInvoice( this.activeWallet, this.parse.data.request @@ -294,22 +323,18 @@ export default { this.parse.paymentChecker = setInterval(() => { if (payResponse.data.paid) { clearInterval(this.parse.paymentChecker) - dismissPaymentMsg() - this.closeDialog() + const preimageHtml = `Preimage: ${payResponse.data.preimage}
` + this.showPaymentCompentedCard(preimageHtml) } - }, 2000) + }, 1000) } catch (err) { + console.error('### err', JSON.stringify(err)) this.showErrorCard(err, 'Cannot pay BOLT11 invoice!') - dismissPaymentMsg() } }, payLnurl: async function () { - const dismissPaymentMsg = this.$q.notify({ - timeout: 0, - message: 'Processing payment...', - }) - try { + this.showPaymentInProgressCard() const response = await lnbitsApi(this.serverUrl).payLnurl( this.activeWallet, this.parse.lnurlpay.callback, @@ -329,30 +354,21 @@ export default { response.data.payment_hash ) if (res.data.paid) { - // this.showDialog = false - dismissPaymentMsg() clearInterval(this.parse.paymentChecker) // show lnurlpay success action if (response.data.success_action) { switch (response.data.success_action.tag) { case 'url': - this.$q.notify({ - message: `${response.data.success_action.url}`, - caption: response.data.success_action.description, - html: true, - type: 'positive', - timeout: 0, - closeBtn: true, - }) + const actionDescription = `Message: ${response.data.success_action.description}` + const actionLink = `${response.data.success_action.url}` + this.showPaymentCompentedCard( + `${actionDescription}
${actionLink}
Message: ${response.data.success_action.message}
` + this.showPaymentCompentedCard(message) break } } @@ -360,7 +376,6 @@ export default { }, 2000) } catch (err) { this.showErrorCard(err, 'Cannot pay LNURL invoice!') - dismissPaymentMsg() } }, gotoOptionsPage() { @@ -374,6 +389,18 @@ export default { this.error.title = title this.error.message = (err.message || err) + '.' }, + showPaymentInProgressCard() { + this.currentView = 'paymentStatus' + this.paymentDetails.isPayed = false + this.paymentDetails.message = 'Processing payment...' + this.paymentDetails.details = '' + }, + showPaymentCompentedCard(details = '') { + this.currentView = 'paymentStatus' + this.paymentDetails.isPayed = true + this.paymentDetails.message = 'Payment Successful!' + this.paymentDetails.details = details + }, }, mounted: async function () { this.showDialog = true diff --git a/src/views/content-inject/content.js b/src/views/content-inject/content.js index 8e82fb7..091080a 100644 --- a/src/views/content-inject/content.js +++ b/src/views/content-inject/content.js @@ -32,7 +32,7 @@ try { window.addEventListener("message", (e) => { const data = e.data; if (router.currentRoute.path === '/payment') { - router.replace('/foo') + router.replace('/loading') } setTimeout(() => { router.replace({ diff --git a/src/views/content-inject/routes.js b/src/views/content-inject/routes.js index acc149c..eb75181 100644 --- a/src/views/content-inject/routes.js +++ b/src/views/content-inject/routes.js @@ -1,17 +1,7 @@ -import Foo from '../../components/Foo.vue' -import Bar from '../../components/Bar.vue' import Loading from '../../components/Loading.vue' import PayInvoice from '../../components/PayInvoice.vue' const routes = [{ - path: '/foo', - component: Foo - }, - { - path: '/bar', - component: Bar - }, - { path: '/payment', component: PayInvoice }, diff --git a/src/views/options/routes.js b/src/views/options/routes.js deleted file mode 100644 index 50f7036..0000000 --- a/src/views/options/routes.js +++ /dev/null @@ -1,14 +0,0 @@ -import Foo from '../../components/Foo.vue' -import Bar from '../../components/Bar.vue' - -const routes = [{ - path: '/foo', - component: Foo - }, - { - path: '/bar', - component: Bar - } -] - -export default routes \ No newline at end of file