diff --git a/src/modules/activities/services/TicketApiService.ts b/src/modules/activities/services/TicketApiService.ts index 432771d..64c5fdb 100644 --- a/src/modules/activities/services/TicketApiService.ts +++ b/src/modules/activities/services/TicketApiService.ts @@ -34,6 +34,20 @@ export class TicketApiService { return response } + /** + * Fetch the authenticated user's own events across all their wallets, + * regardless of status. Lets the webapp show the user's pending / + * rejected events alongside the public approved feed — without this + * a user who edits under `auto_approve=false` loses sight of their + * own event the moment it drops to `proposed`. + */ + async fetchMyEvents(invoiceKey: string): Promise { + return this.request('/events/api/v1/events?all_wallets=true', { + method: 'GET', + headers: { 'X-API-KEY': invoiceKey }, + }) + } + /** * Request a ticket purchase (creates a Lightning invoice). * Uses POST /tickets/{event_id} with user_id in body (upstream API). @@ -187,14 +201,16 @@ export class TicketApiService { } /** - * Read the extension's auto_approve flag. Admin-only endpoint, so - * non-admin callers see false (the safe default for UI gating). + * Read the extension's auto_approve flag. Hits the public probe + * (invoice-key-gated, available to any wallet holder), so non-admin + * users see the real value and the edit-flow copy is accurate. + * Degrades to `false` on failure — the safer default for warning UI. */ - async getAutoApprove(adminKey: string): Promise { + async getAutoApprove(invoiceKey: string): Promise { try { - const settings = await this.request('/events/api/v1/events/settings', { + const settings = await this.request('/events/api/v1/events/settings/public', { method: 'GET', - headers: { 'X-API-KEY': adminKey }, + headers: { 'X-API-KEY': invoiceKey }, }) return Boolean(settings?.auto_approve) } catch {