feat: move logic to relay-details component

This commit is contained in:
Vlad Stan 2023-02-07 14:24:12 +02:00
parent 999bb1683f
commit 1bc8640640
4 changed files with 60 additions and 42 deletions

View file

@ -35,6 +35,12 @@ const relays = async () => {
label: 'ID',
field: 'id'
},
{
name: 'toggle',
align: 'left',
label: 'Active',
field: ''
},
{
name: 'name',
align: 'left',
@ -146,33 +152,17 @@ const relays = async () => {
}
},
deleteRelay: function (relayId) {
LNbits.utils
.confirmDialog(
'All data will be lost! Are you sure you want to delete this relay?'
)
.onOk(async () => {
try {
const response = await LNbits.api.request(
'DELETE',
'/nostrrelay/api/v1/relay/' + relayId,
this.g.user.wallets[0].adminkey
)
this.relayLinks = _.reject(this.relayLinks, function (obj) {
return obj.id === relayId
})
} catch (error) {
LNbits.utils.notifyApiError(error)
}
})
},
sendFormDataRelay: async function () {
console.log('### sendFormDataRelay')
this.createRelay(this.formDialogRelay.data)
},
handleRelayDeleted: function (relayId) {
this.relayLinks = _.reject(this.relayLinks, function (obj) {
return obj.id === relayId
})
},
exportrelayCSV: function () {
LNbits.utils.exportCSV(
this.relaysTable.columns,