feat(activities): fetchMyEvents + invoice-key auto_approve probe
`fetchMyEvents` hits the existing all_wallets=true endpoint to surface the caller's own events regardless of status. `getAutoApprove` now calls the public probe (invoice-key-gated) added in events extension v1.3.0-aio.5 so non-admin webapp users get accurate edit-flow copy. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
af3c9853c0
commit
3047565920
1 changed files with 21 additions and 5 deletions
|
|
@ -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<any[]> {
|
||||
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<boolean> {
|
||||
async getAutoApprove(invoiceKey: string): Promise<boolean> {
|
||||
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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue