feat: confirm before delete
This commit is contained in:
parent
cec1ae7e10
commit
c81a804dea
1 changed files with 22 additions and 6 deletions
|
|
@ -59,7 +59,8 @@
|
||||||
</div>
|
</div>
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td auto-width>
|
<q-td auto-width>
|
||||||
<q-btn flat dense size="xs" @click="deleteRelay(props.row.url)" icon="cancel" color="pink"></q-btn>
|
<q-btn flat dense size="md" @click="showDeleteRelayDialog(props.row.url)" icon="cancel"
|
||||||
|
color="pink"></q-btn>
|
||||||
</q-td>
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -255,6 +256,13 @@
|
||||||
label: 'Ping',
|
label: 'Ping',
|
||||||
field: 'ping'
|
field: 'ping'
|
||||||
}
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
name: 'delete',
|
||||||
|
align: 'center',
|
||||||
|
label: '',
|
||||||
|
field: ''
|
||||||
|
}
|
||||||
],
|
],
|
||||||
pagination: {
|
pagination: {
|
||||||
rowsPerPage: 10
|
rowsPerPage: 10
|
||||||
|
|
@ -329,8 +337,14 @@
|
||||||
this.relayToAdd = relayUrl
|
this.relayToAdd = relayUrl
|
||||||
await this.addRelay()
|
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) {
|
deleteRelay(url) {
|
||||||
console.log('DELETE RELAY ' + url)
|
|
||||||
LNbits.api
|
LNbits.api
|
||||||
.request(
|
.request(
|
||||||
'DELETE',
|
'DELETE',
|
||||||
|
|
@ -338,12 +352,14 @@
|
||||||
this.g.user.wallets[0].adminkey,
|
this.g.user.wallets[0].adminkey,
|
||||||
{ url: url }
|
{ url: url }
|
||||||
)
|
)
|
||||||
.then(function (response) {
|
.then((response) => {
|
||||||
if (response.data) {
|
const relayIndex = this.nostrrelayLinks.indexOf(r => r.url === url)
|
||||||
console.log(response.data)
|
if (relayIndex !== -1) {
|
||||||
|
this.nostrrelayLinks.splice(relayIndex, 1)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch((error) => {
|
||||||
|
console.error(error)
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue