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>
This commit is contained in:
parent
d740cb1f97
commit
b467826622
1 changed files with 21 additions and 5 deletions
|
|
@ -11,6 +11,7 @@ window.app = Vue.createApp({
|
|||
data() {
|
||||
return {
|
||||
events: [],
|
||||
pendingEvents: [],
|
||||
tickets: [],
|
||||
currencies: [],
|
||||
eventsTable: {
|
||||
|
|
@ -113,11 +114,6 @@ window.app = Vue.createApp({
|
|||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
pendingEvents() {
|
||||
return this.events.filter(e => e.status === 'proposed')
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
approveEvent(eventId) {
|
||||
LNbits.utils
|
||||
|
|
@ -135,6 +131,7 @@ window.app = Vue.createApp({
|
|||
message: 'Event approved'
|
||||
})
|
||||
this.getEvents()
|
||||
this.getPendingEvents()
|
||||
})
|
||||
.catch(err => {
|
||||
LNbits.utils.notifyApiError(err)
|
||||
|
|
@ -157,6 +154,7 @@ window.app = Vue.createApp({
|
|||
message: 'Event rejected'
|
||||
})
|
||||
this.getEvents()
|
||||
this.getPendingEvents()
|
||||
})
|
||||
.catch(err => {
|
||||
LNbits.utils.notifyApiError(err)
|
||||
|
|
@ -217,6 +215,23 @@ window.app = Vue.createApp({
|
|||
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() {
|
||||
const wallet = _.findWhere(this.g.user.wallets, {
|
||||
id: this.formDialog.data.wallet
|
||||
|
|
@ -340,6 +355,7 @@ window.app = Vue.createApp({
|
|||
if (this.g.user.wallets.length) {
|
||||
this.getTickets()
|
||||
this.getEvents()
|
||||
this.getPendingEvents()
|
||||
this.currencies = await LNbits.api.getCurrencies()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue