chore: code clean-up

This commit is contained in:
Vlad Stan 2022-07-06 16:45:03 +03:00
parent 8e05a11978
commit b5e97f08a6

View file

@ -38,10 +38,10 @@
<q-table <q-table
flat flat
dense dense
:data="ChargeLinks" :data="chargeLinks"
row-key="id" row-key="id"
:columns="ChargesTable.columns" :columns="chargesTable.columns"
:pagination.sync="ChargesTable.pagination" :pagination.sync="chargesTable.pagination"
:filter="filter" :filter="filter"
> >
<template v-slot:header="props"> <template v-slot:header="props">
@ -158,7 +158,6 @@
<q-dialog <q-dialog
v-model="formDialogCharge.show" v-model="formDialogCharge.show"
position="top" position="top"
@hide="closeFormDialog"
> >
<q-card class="q-pa-lg q-pt-xl lnbits__dialog-card"> <q-card class="q-pa-lg q-pt-xl lnbits__dialog-card">
<q-form @submit="sendFormDataCharge" class="q-gutter-md"> <q-form @submit="sendFormDataCharge" class="q-gutter-md">
@ -310,23 +309,15 @@
data: function () { data: function () {
return { return {
filter: '', filter: '',
watchonlyactive: false,
balance: null, balance: null,
checker: null,
walletLinks: [], walletLinks: [],
ChargeLinks: [], chargeLinks: [],
ChargeLinksObj: [],
onchainwallet: '', onchainwallet: '',
currentaddress: '',
Addresses: {
show: false,
data: null
},
mempool: { mempool: {
endpoint: '' endpoint: ''
}, },
ChargesTable: { chargesTable: {
columns: [ columns: [
{ {
name: 'theId', name: 'theId',
@ -393,10 +384,7 @@
rowsPerPage: 10 rowsPerPage: 10
} }
}, },
formDialog: {
show: false,
data: {}
},
formDialogCharge: { formDialogCharge: {
show: false, show: false,
data: { data: {
@ -407,10 +395,6 @@
time: null, time: null,
amount: null amount: null
} }
},
qrCodeDialog: {
show: false,
data: null
} }
} }
}, },
@ -441,11 +425,6 @@
LNbits.utils.notifyApiError(error) LNbits.utils.notifyApiError(error)
} }
}, },
closeFormDialog: function () {
this.formDialog.data = {
is_unique: false
}
},
getCharges: async function () { getCharges: async function () {
try { try {
@ -454,7 +433,7 @@
'/satspay/api/v1/charges', '/satspay/api/v1/charges',
this.g.user.wallets[0].inkey this.g.user.wallets[0].inkey
) )
this.ChargeLinks = data.map(mapCharge) this.chargeLinks = data.map(mapCharge)
} catch (error) { } catch (error) {
LNbits.utils.notifyApiError(error) LNbits.utils.notifyApiError(error)
} }
@ -469,13 +448,13 @@
}, },
timerCount: function () { timerCount: function () {
setInterval(async () => { setInterval(async () => {
for (i = 0; i < this.ChargeLinks.length - 1; i++) { for (i = 0; i < this.chargeLinks.length - 1; i++) {
if (this.ChargeLinks[i]['paid'] == 'True') { if (this.chargeLinks[i]['paid'] == 'True') {
setTimeout(async () => { setTimeout(async () => {
await LNbits.api.request( await LNbits.api.request(
'GET', 'GET',
'/satspay/api/v1/charges/balance/' + '/satspay/api/v1/charges/balance/' +
this.ChargeLinks[i]['id'], this.chargeLinks[i]['id'],
'filla' 'filla'
) )
}, 2000) }, 2000)
@ -493,7 +472,7 @@
data data
) )
this.ChargeLinks.push(mapCharge(resp.data)) this.chargeLinks.push(mapCharge(resp.data))
this.formDialogCharge.show = false this.formDialogCharge.show = false
this.formDialogCharge.data = { this.formDialogCharge.data = {
onchain: false, onchain: false,
@ -508,7 +487,7 @@
}, },
deleteChargeLink: function (chargeId) { deleteChargeLink: function (chargeId) {
const link = _.findWhere(this.ChargeLinks, {id: chargeId}) const link = _.findWhere(this.chargeLinks, {id: chargeId})
LNbits.utils LNbits.utils
.confirmDialog('Are you sure you want to delete this pay link?') .confirmDialog('Are you sure you want to delete this pay link?')
.onOk(async () => { .onOk(async () => {
@ -519,7 +498,7 @@
this.g.user.wallets[0].adminkey this.g.user.wallets[0].adminkey
) )
this.ChargeLinks = _.reject(this.ChargeLinks, function (obj) { this.chargeLinks = _.reject(this.chargeLinks, function (obj) {
return obj.id === chargeId return obj.id === chargeId
}) })
} catch (error) { } catch (error) {
@ -528,7 +507,7 @@
}) })
}, },
exportchargeCSV: function () { exportchargeCSV: function () {
LNbits.utils.exportCSV(this.ChargesTable.columns, this.ChargeLinks) LNbits.utils.exportCSV(this.chargesTable.columns, this.chargeLinks)
} }
}, },
created: async function () { created: async function () {