mirror of
https://github.com/lnbits/lnbits.git
synced 2025-03-30 04:32:01 +02:00
fix: payment list updates (#2493)
* fix: payment list updates --------- Co-authored-by: Vlad Stan <stan.v.vlad@gmail.com>
This commit is contained in:
parent
ab3fe79a7e
commit
8ee2948f71
@ -102,7 +102,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
<payment-list :wallet="this.g.wallet" :mobileSimple="mobileSimple" />
|
<payment-list
|
||||||
|
:update="updatePayments"
|
||||||
|
:wallet="this.g.wallet"
|
||||||
|
:mobileSimple="mobileSimple"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
{% if HIDE_API %}
|
{% if HIDE_API %}
|
||||||
<div class="col-12 col-md-4 q-gutter-y-md">
|
<div class="col-12 col-md-4 q-gutter-y-md">
|
||||||
|
18
lnbits/static/bundle.min.js
vendored
18
lnbits/static/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
Vue.component('payment-list', {
|
Vue.component('payment-list', {
|
||||||
name: 'payment-list',
|
name: 'payment-list',
|
||||||
props: ['wallet', 'mobileSimple', 'lazy'],
|
props: ['update', 'wallet', 'mobileSimple', 'lazy'],
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
denomination: LNBITS_DENOMINATION,
|
denomination: LNBITS_DENOMINATION,
|
||||||
@ -163,12 +163,22 @@ Vue.component('payment-list', {
|
|||||||
this.wallet.name + '-payments'
|
this.wallet.name + '-payments'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
formatCurrency: function (currency, amount) {
|
||||||
|
try {
|
||||||
|
return LNbits.utils.formatCurrency(currency, amount)
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(error)
|
||||||
|
return `${amount} ???`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
lazy: function (newVal) {
|
lazy: function (newVal) {
|
||||||
debugger
|
|
||||||
if (newVal === true) this.fetchPayments()
|
if (newVal === true) this.fetchPayments()
|
||||||
|
},
|
||||||
|
update: function () {
|
||||||
|
this.fetchPayments()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created: function () {
|
created: function () {
|
||||||
@ -294,13 +304,13 @@ Vue.component('payment-list', {
|
|||||||
<br />
|
<br />
|
||||||
<i v-if="props.row.extra.wallet_fiat_currency">
|
<i v-if="props.row.extra.wallet_fiat_currency">
|
||||||
<span
|
<span
|
||||||
v-text="LNbits.utils.formatCurrency(props.row.extra.wallet_fiat_currency, props.row.extra.wallet_fiat_amount)"
|
v-text="formatCurrency(props.row.extra.wallet_fiat_currency, props.row.extra.wallet_fiat_amount)"
|
||||||
></span>
|
></span>
|
||||||
<br />
|
<br />
|
||||||
</i>
|
</i>
|
||||||
<i v-if="props.row.extra.fiat_currency">
|
<i v-if="props.row.extra.fiat_currency">
|
||||||
<span
|
<span
|
||||||
v-text="LNbits.utils.formatCurrency(props.row.extra.fiat_currency, props.row.extra.fiat_amount)"
|
v-text="formatCurrency(props.row.extra.fiat_currency, props.row.extra.fiat_amount)"
|
||||||
></span>
|
></span>
|
||||||
</i>
|
</i>
|
||||||
</q-td>
|
</q-td>
|
||||||
|
@ -8,6 +8,7 @@ new Vue({
|
|||||||
mixins: [windowMixin],
|
mixins: [windowMixin],
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
|
updatePayments: false,
|
||||||
origin: window.location.origin,
|
origin: window.location.origin,
|
||||||
user: LNbits.map.user(window.user),
|
user: LNbits.map.user(window.user),
|
||||||
receive: {
|
receive: {
|
||||||
@ -123,6 +124,7 @@ new Vue({
|
|||||||
}, 10000)
|
}, 10000)
|
||||||
},
|
},
|
||||||
onPaymentReceived: function (paymentHash) {
|
onPaymentReceived: function (paymentHash) {
|
||||||
|
this.updatePayments = !this.updatePayments
|
||||||
if (this.receive.paymentHash === paymentHash) {
|
if (this.receive.paymentHash === paymentHash) {
|
||||||
this.receive.show = false
|
this.receive.show = false
|
||||||
this.receive.paymentHash = null
|
this.receive.paymentHash = null
|
||||||
@ -170,6 +172,9 @@ new Vue({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.updatePayments = !this.updatePayments
|
||||||
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
LNbits.utils.notifyApiError(err)
|
LNbits.utils.notifyApiError(err)
|
||||||
this.receive.status = 'pending'
|
this.receive.status = 'pending'
|
||||||
@ -551,6 +556,11 @@ new Vue({
|
|||||||
this.update.currency = this.g.wallet.currency
|
this.update.currency = this.g.wallet.currency
|
||||||
this.receive.units = ['sat', ...window.currencies]
|
this.receive.units = ['sat', ...window.currencies]
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
updatePayments: function () {
|
||||||
|
this.fetchBalance()
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
// show disclaimer
|
// show disclaimer
|
||||||
if (!this.$q.localStorage.getItem('lnbits.disclaimerShown')) {
|
if (!this.$q.localStorage.getItem('lnbits.disclaimerShown')) {
|
||||||
@ -558,9 +568,9 @@ new Vue({
|
|||||||
this.$q.localStorage.set('lnbits.disclaimerShown', true)
|
this.$q.localStorage.set('lnbits.disclaimerShown', true)
|
||||||
}
|
}
|
||||||
// listen to incoming payments
|
// listen to incoming payments
|
||||||
LNbits.events.onInvoicePaid(this.g.wallet, payment =>
|
LNbits.events.onInvoicePaid(this.g.wallet, payment => {
|
||||||
this.onPaymentReceived(payment.payment_hash)
|
this.onPaymentReceived(payment.payment_hash)
|
||||||
)
|
})
|
||||||
eventReactionWebocket(wallet.id)
|
eventReactionWebocket(wallet.id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user