feat: event proposal and approval workflow #9
1 changed files with 21 additions and 5 deletions
fix: fetch pending events separately from admin's own events
Some checks failed
lint.yml / fix: fetch pending events separately from admin's own events (pull_request) Failing after 0s
Some checks failed
lint.yml / fix: fetch pending events separately from admin's own events (pull_request) Failing after 0s
Pending events from other users' wallets weren't visible because getEvents() only returns events scoped to the admin's wallets. Add separate getPendingEvents() that calls /events/pending endpoint. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
commit
b467826622
|
|
@ -11,6 +11,7 @@ window.app = Vue.createApp({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
events: [],
|
events: [],
|
||||||
|
pendingEvents: [],
|
||||||
tickets: [],
|
tickets: [],
|
||||||
currencies: [],
|
currencies: [],
|
||||||
eventsTable: {
|
eventsTable: {
|
||||||
|
|
@ -113,11 +114,6 @@ window.app = Vue.createApp({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
pendingEvents() {
|
|
||||||
return this.events.filter(e => e.status === 'proposed')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
approveEvent(eventId) {
|
approveEvent(eventId) {
|
||||||
LNbits.utils
|
LNbits.utils
|
||||||
|
|
@ -135,6 +131,7 @@ window.app = Vue.createApp({
|
||||||
message: 'Event approved'
|
message: 'Event approved'
|
||||||
})
|
})
|
||||||
this.getEvents()
|
this.getEvents()
|
||||||
|
this.getPendingEvents()
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
LNbits.utils.notifyApiError(err)
|
LNbits.utils.notifyApiError(err)
|
||||||
|
|
@ -157,6 +154,7 @@ window.app = Vue.createApp({
|
||||||
message: 'Event rejected'
|
message: 'Event rejected'
|
||||||
})
|
})
|
||||||
this.getEvents()
|
this.getEvents()
|
||||||
|
this.getPendingEvents()
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
LNbits.utils.notifyApiError(err)
|
LNbits.utils.notifyApiError(err)
|
||||||
|
|
@ -217,6 +215,23 @@ window.app = Vue.createApp({
|
||||||
this.checkCanceledEvents()
|
this.checkCanceledEvents()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getPendingEvents() {
|
||||||
|
LNbits.api
|
||||||
|
.request(
|
||||||
|
'GET',
|
||||||
|
'/events/api/v1/events/pending',
|
||||||
|
this.g.user.wallets[0].adminkey
|
||||||
|
)
|
||||||
|
.then(response => {
|
||||||
|
this.pendingEvents = response.data.map(obj => {
|
||||||
|
return mapEvents(obj)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
// Not an admin or no pending events
|
||||||
|
this.pendingEvents = []
|
||||||
|
})
|
||||||
|
},
|
||||||
sendEventData() {
|
sendEventData() {
|
||||||
const wallet = _.findWhere(this.g.user.wallets, {
|
const wallet = _.findWhere(this.g.user.wallets, {
|
||||||
id: this.formDialog.data.wallet
|
id: this.formDialog.data.wallet
|
||||||
|
|
@ -340,6 +355,7 @@ window.app = Vue.createApp({
|
||||||
if (this.g.user.wallets.length) {
|
if (this.g.user.wallets.length) {
|
||||||
this.getTickets()
|
this.getTickets()
|
||||||
this.getEvents()
|
this.getEvents()
|
||||||
|
this.getPendingEvents()
|
||||||
this.currencies = await LNbits.api.getCurrencies()
|
this.currencies = await LNbits.api.getCurrencies()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue