diff --git a/templates/nostrclient/index.html b/templates/nostrclient/index.html
index 7e83b6d..f200973 100644
--- a/templates/nostrclient/index.html
+++ b/templates/nostrclient/index.html
@@ -59,7 +59,8 @@
-
+
@@ -255,6 +256,13 @@
label: 'Ping',
field: 'ping'
}
+ ,
+ {
+ name: 'delete',
+ align: 'center',
+ label: '',
+ field: ''
+ }
],
pagination: {
rowsPerPage: 10
@@ -329,8 +337,14 @@
this.relayToAdd = relayUrl
await this.addRelay()
},
+ showDeleteRelayDialog: function (url) {
+ LNbits.utils
+ .confirmDialog(' Are you sure you want to remove this relay?')
+ .onOk(async () => {
+ this.deleteRelay(url)
+ })
+ },
deleteRelay(url) {
- console.log('DELETE RELAY ' + url)
LNbits.api
.request(
'DELETE',
@@ -338,12 +352,14 @@
this.g.user.wallets[0].adminkey,
{ url: url }
)
- .then(function (response) {
- if (response.data) {
- console.log(response.data)
+ .then((response) => {
+ const relayIndex = this.nostrrelayLinks.indexOf(r => r.url === url)
+ if (relayIndex !== -1) {
+ this.nostrrelayLinks.splice(relayIndex, 1)
}
})
- .catch(function (error) {
+ .catch((error) => {
+ console.error(error)
LNbits.utils.notifyApiError(error)
})
},