refactor: clean-up unnecessary self
This commit is contained in:
parent
6cfa8e30bc
commit
50b2dcfcaa
1 changed files with 20 additions and 26 deletions
|
|
@ -416,15 +416,14 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
cancelCharge: function (data) {
|
cancelCharge: function (data) {
|
||||||
var self = this
|
this.formDialogCharge.data.description = ''
|
||||||
self.formDialogCharge.data.description = ''
|
this.formDialogCharge.data.onchainwallet = ''
|
||||||
self.formDialogCharge.data.onchainwallet = ''
|
this.formDialogCharge.data.lnbitswallet = ''
|
||||||
self.formDialogCharge.data.lnbitswallet = ''
|
this.formDialogCharge.data.time = null
|
||||||
self.formDialogCharge.data.time = null
|
this.formDialogCharge.data.amount = null
|
||||||
self.formDialogCharge.data.amount = null
|
this.formDialogCharge.data.webhook = ''
|
||||||
self.formDialogCharge.data.webhook = ''
|
this.formDialogCharge.data.completelink = ''
|
||||||
self.formDialogCharge.data.completelink = ''
|
this.formDialogCharge.show = false
|
||||||
self.formDialogCharge.show = false
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getWalletLinks: async function () {
|
getWalletLinks: async function () {
|
||||||
|
|
@ -449,11 +448,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
openQrCodeDialog: function (linkId) {
|
openQrCodeDialog: function (linkId) {
|
||||||
var self = this
|
|
||||||
var getAddresses = this.getAddresses
|
var getAddresses = this.getAddresses
|
||||||
getAddresses(linkId)
|
getAddresses(linkId)
|
||||||
self.current = linkId
|
this.current = linkId
|
||||||
self.Addresses.show = true
|
this.Addresses.show = true
|
||||||
},
|
},
|
||||||
getCharges: async function () {
|
getCharges: async function () {
|
||||||
try {
|
try {
|
||||||
|
|
@ -468,30 +466,28 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sendFormDataCharge: function () {
|
sendFormDataCharge: function () {
|
||||||
var self = this
|
const wallet = this.g.user.wallets[0].inkey
|
||||||
var wallet = this.g.user.wallets[0].inkey
|
const data = this.formDialogCharge.data
|
||||||
var data = this.formDialogCharge.data
|
|
||||||
data.amount = parseInt(data.amount)
|
data.amount = parseInt(data.amount)
|
||||||
data.time = parseInt(data.time)
|
data.time = parseInt(data.time)
|
||||||
data.onchainwallet = this.onchainwallet?.id
|
data.onchainwallet = this.onchainwallet?.id
|
||||||
this.createCharge(wallet, data)
|
this.createCharge(wallet, data)
|
||||||
},
|
},
|
||||||
timerCount: function () {
|
timerCount: function () {
|
||||||
self = this
|
var refreshIntervalId = setInterval( () => {
|
||||||
var refreshIntervalId = setInterval(function () {
|
for (i = 0; i < this.ChargeLinks.length - 1; i++) {
|
||||||
for (i = 0; i < self.ChargeLinks.length - 1; i++) {
|
if (this.ChargeLinks[i]['paid'] == 'True') {
|
||||||
if (self.ChargeLinks[i]['paid'] == 'True') {
|
|
||||||
setTimeout(async function () {
|
setTimeout(async function () {
|
||||||
await LNbits.api.request(
|
await LNbits.api.request(
|
||||||
'GET',
|
'GET',
|
||||||
'/satspay/api/v1/charges/balance/' +
|
'/satspay/api/v1/charges/balance/' +
|
||||||
self.ChargeLinks[i]['id'],
|
this.ChargeLinks[i]['id'],
|
||||||
'filla'
|
'filla'
|
||||||
)
|
)
|
||||||
}, 2000)
|
}, 2000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.getCharges()
|
this.getCharges()
|
||||||
}, 20000)
|
}, 20000)
|
||||||
},
|
},
|
||||||
createCharge: async function (wallet, data) {
|
createCharge: async function (wallet, data) {
|
||||||
|
|
@ -518,19 +514,18 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteChargeLink: function (chargeId) {
|
deleteChargeLink: function (chargeId) {
|
||||||
var self = this
|
|
||||||
var link = _.findWhere(this.ChargeLinks, {id: chargeId})
|
var 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 function () {
|
.onOk(async () => {
|
||||||
try {
|
try {
|
||||||
const response = await LNbits.api.request(
|
const response = await LNbits.api.request(
|
||||||
'DELETE',
|
'DELETE',
|
||||||
'/satspay/api/v1/charge/' + chargeId,
|
'/satspay/api/v1/charge/' + chargeId,
|
||||||
self.g.user.wallets[0].adminkey
|
this.g.user.wallets[0].adminkey
|
||||||
)
|
)
|
||||||
|
|
||||||
self.ChargeLinks = _.reject(self.ChargeLinks, function (obj) {
|
this.ChargeLinks = _.reject(this.ChargeLinks, function (obj) {
|
||||||
return obj.id === chargeId
|
return obj.id === chargeId
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -544,7 +539,6 @@
|
||||||
},
|
},
|
||||||
created: function () {
|
created: function () {
|
||||||
console.log(this.g.user)
|
console.log(this.g.user)
|
||||||
var self = this
|
|
||||||
var getCharges = this.getCharges
|
var getCharges = this.getCharges
|
||||||
getCharges()
|
getCharges()
|
||||||
var getWalletLinks = this.getWalletLinks
|
var getWalletLinks = this.getWalletLinks
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue