From b467826622ff1e4414c0e658ab595f485ce1e31e Mon Sep 17 00:00:00 2001 From: Padreug Date: Mon, 27 Apr 2026 11:16:29 +0200 Subject: [PATCH] fix: fetch pending events separately from admin's own events 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) --- static/js/index.js | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/static/js/index.js b/static/js/index.js index 74e95b4..1619854 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -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() } }