fix: delete account
This commit is contained in:
parent
f7fb926c52
commit
f19fb4a18e
4 changed files with 85 additions and 4 deletions
|
|
@ -545,7 +545,7 @@
|
|||
><q-card-section>
|
||||
<div class="row items-center no-wrap q-mb-md">
|
||||
<div class="col-2 q-pr-lg">Public Key:</div>
|
||||
<div class="col-6 q-pr-lg">
|
||||
<div class="col-5 q-pr-lg">
|
||||
<q-input
|
||||
filled
|
||||
dense
|
||||
|
|
@ -557,16 +557,16 @@
|
|||
<q-btn
|
||||
unelevated
|
||||
color="green"
|
||||
class="float-right"
|
||||
class="float-left"
|
||||
@click="allowPublicKey(accountPubkey, true)"
|
||||
>Allow</q-btn
|
||||
>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="col-3">
|
||||
<q-btn
|
||||
unelevated
|
||||
color="pink"
|
||||
class="float-right"
|
||||
class="float-left"
|
||||
@click="blockPublicKey(accountPubkey, true)"
|
||||
>Block</q-btn
|
||||
>
|
||||
|
|
@ -613,6 +613,16 @@
|
|||
>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props">
|
||||
<q-td key="action" :props="props">
|
||||
<q-btn
|
||||
dense
|
||||
color="pink"
|
||||
class="float-right"
|
||||
@click="removePublicKey(props.row.pubkey)"
|
||||
size="sm"
|
||||
>Delete</q-btn
|
||||
>
|
||||
</q-td>
|
||||
<q-td key="pubkey" :props="props">
|
||||
{{props.row.pubkey}}
|
||||
</q-td>
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue