feat: add admin-toggleable auto-approve setting
Some checks failed
lint.yml / feat: add admin-toggleable auto-approve setting (pull_request) Failing after 0s
Some checks failed
lint.yml / feat: add admin-toggleable auto-approve setting (pull_request) Failing after 0s
- Extension settings table with auto_approve boolean - GET/PUT /api/v1/settings endpoints (LNbits admin only) - Settings card in admin UI with toggle - When auto_approve is enabled, non-admin events skip approval Closes aiolabs/events#11 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2db0102857
commit
d69ec7dda2
6 changed files with 116 additions and 4 deletions
|
|
@ -14,6 +14,9 @@ window.app = Vue.createApp({
|
|||
allUserEvents: [],
|
||||
pendingEvents: [],
|
||||
isAdmin: false,
|
||||
settings: {
|
||||
auto_approve: false
|
||||
},
|
||||
tickets: [],
|
||||
currencies: [],
|
||||
eventsTable: {
|
||||
|
|
@ -117,6 +120,29 @@ window.app = Vue.createApp({
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
getSettings() {
|
||||
LNbits.api
|
||||
.request('GET', '/events/api/v1/settings')
|
||||
.then(response => {
|
||||
this.settings = response.data
|
||||
})
|
||||
.catch(() => {
|
||||
// Not admin or settings not available
|
||||
})
|
||||
},
|
||||
saveSettings() {
|
||||
LNbits.api
|
||||
.request('PUT', '/events/api/v1/settings', null, this.settings)
|
||||
.then(() => {
|
||||
this.$q.notify({
|
||||
type: 'positive',
|
||||
message: 'Settings saved'
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
LNbits.utils.notifyApiError(err)
|
||||
})
|
||||
},
|
||||
approveEvent(eventId) {
|
||||
LNbits.utils
|
||||
.confirmDialog('Approve this event?')
|
||||
|
|
@ -375,6 +401,7 @@ window.app = Vue.createApp({
|
|||
this.getTickets()
|
||||
this.getEvents()
|
||||
this.getPendingEvents()
|
||||
this.getSettings()
|
||||
this.currencies = await LNbits.api.getCurrencies()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue