fix: delete account

This commit is contained in:
Vlad Stan 2023-04-06 16:59:15 +03:00
parent f7fb926c52
commit f19fb4a18e
4 changed files with 85 additions and 4 deletions

View file

@ -23,6 +23,12 @@ async function relayDetails(path) {
showAllowedAccounts: false,
accountsTable: {
columns: [
{
name: 'action',
align: 'left',
label: '',
field: ''
},
{
name: 'pubkey',
align: 'left',
@ -158,6 +164,7 @@ async function relayDetails(path) {
timeout: 5000
})
} catch (error) {
console.warn(error)
LNbits.utils.notifyApiError(error)
}
},
@ -183,6 +190,13 @@ async function relayDetails(path) {
blockPublicKey: async function (pubkey, blocked = true) {
await this.updatePublicKey({pubkey, blocked})
},
removePublicKey: async function (pubkey) {
LNbits.utils
.confirmDialog('This public key will be removed from relay!')
.onOk(async () => {
await this.deletePublicKey(pubkey)
})
},
togglePublicKey: async function (account, action) {
if (action === 'allow') {
await this.updatePublicKey({
@ -222,6 +236,25 @@ async function relayDetails(path) {
}
},
deletePublicKey: async function (pubkey) {
try {
await LNbits.api.request(
'DELETE',
`/nostrrelay/api/v1/account/${this.relay.id}/${pubkey}`,
this.adminkey,
{}
)
this.$q.notify({
type: 'positive',
message: 'Account Deleted',
timeout: 5000
})
await this.getAccounts()
} catch (error) {
LNbits.utils.notifyApiError(error)
}
},
addSkipAuthForEvent: function () {
value = +this.skipEventKind
if (this.relay.config.skipedAuthEvents.indexOf(value) != -1) {