fix: g.wallet artifacts in lnbits-payment-list and lnbits-manage-wall... (#3601)

This commit is contained in:
dni ⚡ 2025-12-01 09:10:40 +01:00 committed by GitHub
parent 6449276003
commit ad8b70a098
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 20 deletions

File diff suppressed because one or more lines are too long

View file

@ -3,7 +3,16 @@ window.app.component('lnbits-manage-wallet-list', {
mixins: [window.windowMixin], mixins: [window.windowMixin],
data() { data() {
return { return {
walletName: '' activeWalletId: null
}
},
watch: {
$route(to) {
if (to.path.startsWith('/wallet/')) {
this.activeWalletId = to.params.id
} else {
this.activeWalletId = null
}
} }
} }
}) })

View file

@ -259,7 +259,7 @@ window.app.component('lnbits-payment-list', {
}, },
checkPayment(payment_hash) { checkPayment(payment_hash) {
LNbits.api LNbits.api
.getPayment(this.g.wallet, payment_hash) .getPayment(this.wallet, payment_hash)
.then(res => { .then(res => {
this.update = !this.update this.update = !this.update
if (res.data.status == 'success') { if (res.data.status == 'success') {
@ -319,7 +319,7 @@ window.app.component('lnbits-payment-list', {
}, },
cancelHoldInvoice(payment_hash) { cancelHoldInvoice(payment_hash) {
LNbits.api LNbits.api
.cancelInvoice(this.g.wallet, payment_hash) .cancelInvoice(this.wallet, payment_hash)
.then(() => { .then(() => {
this.update = !this.update this.update = !this.update
Quasar.Notify.create({ Quasar.Notify.create({
@ -331,7 +331,7 @@ window.app.component('lnbits-payment-list', {
}, },
settleHoldInvoice(preimage) { settleHoldInvoice(preimage) {
LNbits.api LNbits.api
.settleInvoice(this.g.wallet, preimage) .settleInvoice(this.wallet, preimage)
.then(() => { .then(() => {
this.update = !this.update this.update = !this.update
Quasar.Notify.create({ Quasar.Notify.create({
@ -354,7 +354,7 @@ window.app.component('lnbits-payment-list', {
direction: pagination.descending ? 'desc' : 'asc' direction: pagination.descending ? 'desc' : 'asc'
} }
const params = new URLSearchParams(query) const params = new URLSearchParams(query)
LNbits.api.getPayments(this.g.wallet, params).then(response => { LNbits.api.getPayments(this.wallet, params).then(response => {
let payments = response.data.data.map(this.mapPayment) let payments = response.data.data.map(this.mapPayment)
let columns = this.paymentsCSV.columns let columns = this.paymentsCSV.columns
@ -382,7 +382,7 @@ window.app.component('lnbits-payment-list', {
LNbits.utils.exportCSV( LNbits.utils.exportCSV(
columns, columns,
payments, payments,
this.g.wallet.name + '-payments' this.wallet.name + '-payments'
) )
}) })
}, },
@ -451,7 +451,7 @@ window.app.component('lnbits-payment-list', {
await LNbits.api.request( await LNbits.api.request(
'PUT', 'PUT',
`/api/v1/payments/${this.selectedPayment.payment_hash}/labels`, `/api/v1/payments/${this.selectedPayment.payment_hash}/labels`,
this.g.wallet.adminkey, this.wallet.adminkey,
{ {
labels: labels labels: labels
} }

View file

@ -11,24 +11,16 @@
)" )"
:key="walletRec.id" :key="walletRec.id"
clickable clickable
:active="g.wallet && g.wallet.id === walletRec.id" :active="walletRec.id === activeWalletId"
@click="$router.push('/wallet/' + walletRec.id)" @click="$router.push('/wallet/' + walletRec.id)"
> >
<q-item-section side> <q-item-section side>
<q-avatar <q-avatar
size="lg" size="lg"
:text-color="$q.dark.isActive ? 'black' : 'grey-3'" :text-color="$q.dark.isActive ? 'black' : 'grey-3'"
:class="g.wallet && g.wallet.id === walletRec.id ? '' : 'disabled'" :disabled="walletRec.id === activeWalletId"
:color=" :color="walletRec.extra.color"
g.wallet && g.wallet.id === walletRec.id :icon="walletRec.extra.icon"
? walletRec.extra.color
: walletRec.extra.color
"
:icon="
g.wallet && g.wallet.id === walletRec.id
? walletRec.extra.icon
: walletRec.extra.icon
"
> >
</q-avatar> </q-avatar>
</q-item-section> </q-item-section>