fix: use POST endpoint for ticket purchase (upstream API compat)

The GET /tickets/{event_id}/user/{user_id} endpoint was a custom
addition not present in the upstream LNbits events extension. Use
the canonical POST /tickets/{event_id} with user_id in the body.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-04-26 23:44:39 +02:00
commit 357ec3f3e1

View file

@ -36,6 +36,7 @@ export class TicketApiService {
/** /**
* Request a ticket purchase (creates a Lightning invoice). * Request a ticket purchase (creates a Lightning invoice).
* Uses POST /tickets/{event_id} with user_id in body (upstream API).
*/ */
async requestTicket( async requestTicket(
eventId: string, eventId: string,
@ -43,12 +44,14 @@ export class TicketApiService {
accessToken: string accessToken: string
): Promise<TicketPurchaseInvoice> { ): Promise<TicketPurchaseInvoice> {
const data = await this.request( const data = await this.request(
`/events/api/v1/tickets/${eventId}/user/${userId}`, `/events/api/v1/tickets/${eventId}`,
{ {
method: 'GET', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${accessToken}`, 'Authorization': `Bearer ${accessToken}`,
}, },
body: JSON.stringify({ user_id: userId }),
} }
) )