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