feat: move logic to relay-details component
This commit is contained in:
parent
999bb1683f
commit
1bc8640640
4 changed files with 60 additions and 42 deletions
|
|
@ -4,7 +4,7 @@ async function relayDetails(path) {
|
|||
name: 'relay-details',
|
||||
template,
|
||||
|
||||
props: [],
|
||||
props: ['relay-id', 'adminkey', 'inkey'],
|
||||
data: function () {
|
||||
return {
|
||||
items: [],
|
||||
|
|
@ -21,6 +21,25 @@ async function relayDetails(path) {
|
|||
methods: {
|
||||
satBtc(val, showUnit = true) {
|
||||
return satOrBtc(val, showUnit, this.satsDenominated)
|
||||
},
|
||||
deleteRelay: function () {
|
||||
LNbits.utils
|
||||
.confirmDialog(
|
||||
'All data will be lost! Are you sure you want to delete this relay?'
|
||||
)
|
||||
.onOk(async () => {
|
||||
try {
|
||||
await LNbits.api.request(
|
||||
'DELETE',
|
||||
'/nostrrelay/api/v1/relay/' + this.relayId,
|
||||
this.adminkey
|
||||
)
|
||||
this.$emit('relay-deleted', this.relayId)
|
||||
} catch (error) {
|
||||
console.warn(error)
|
||||
LNbits.utils.notifyApiError(error)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue