feat: add Switch dropdown options for profile management

- Add "Import Existing Key" option with vpn_key icon
- Add "Generate New Key" option to create fresh nsec
- Add "Remove <name>" option to delete merchant from DB
- Wire up generate-key event to existing generateKeys function

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Ben Weeks 2025-12-24 13:18:51 +00:00
parent ce0cc3813e
commit f466559b51
3 changed files with 58 additions and 3 deletions

View file

@ -19,7 +19,9 @@ window.app.component('merchant-tab', {
'merchant-deleted',
'toggle-merchant-state',
'restart-nostr-connection',
'profile-updated'
'profile-updated',
'import-key',
'generate-key'
],
data: function () {
return {
@ -57,6 +59,32 @@ window.app.component('merchant-tab', {
handleMerchantDeleted: function () {
this.$emit('merchant-deleted')
},
removeMerchant: function () {
const name =
this.merchantConfig?.display_name ||
this.merchantConfig?.name ||
'this merchant'
LNbits.utils
.confirmDialog(
`Are you sure you want to remove "${name}"? This will delete all associated data (stalls, products, orders, messages).`
)
.onOk(async () => {
try {
await LNbits.api.request(
'DELETE',
`/nostrmarket/api/v1/merchant/${this.merchantId}`,
this.adminkey
)
this.$emit('merchant-deleted')
this.$q.notify({
type: 'positive',
message: 'Merchant removed'
})
} catch (error) {
LNbits.utils.notifyApiError(error)
}
})
},
toggleMerchantState: function () {
this.$emit('toggle-merchant-state')
},