feat: improve events browsing filters and calendar
This commit is contained in:
@@ -846,6 +846,33 @@ class ApiClient {
|
||||
return this.request<Types.EventListItemSchema[]>(url, { method: 'GET' });
|
||||
}
|
||||
|
||||
async browseEvents(params: {
|
||||
state?: 'all' | 'completed' | 'upcoming' | 'open';
|
||||
event_type?: 'online' | 'on_site' | 'hybrid';
|
||||
search?: string;
|
||||
date_from?: string;
|
||||
date_to?: string;
|
||||
price_min?: number;
|
||||
price_max?: number;
|
||||
free_only?: boolean;
|
||||
page?: number;
|
||||
} = {}) {
|
||||
const query = new URLSearchParams();
|
||||
if (params.state) query.set('state', params.state);
|
||||
if (params.event_type) query.set('event_type', params.event_type);
|
||||
if (params.search?.trim()) query.set('search', params.search.trim());
|
||||
if (params.date_from) query.set('date_from', params.date_from);
|
||||
if (params.date_to) query.set('date_to', params.date_to);
|
||||
if (params.price_min != null) query.set('price_min', String(params.price_min));
|
||||
if (params.price_max != null) query.set('price_max', String(params.price_max));
|
||||
if (params.free_only) query.set('free_only', 'true');
|
||||
if (params.page != null) query.set('page', String(params.page));
|
||||
return this.request<Types.EventBrowsePageSchema>(
|
||||
`/api/events/browse/${query.size ? `?${query.toString()}` : ''}`,
|
||||
{ method: 'GET' },
|
||||
);
|
||||
}
|
||||
|
||||
async getEventBySlug(slug: string) {
|
||||
return this.request<Types.EventDetailSchema>(`/api/events/slug/${encodeURIComponent(slug)}`, { method: 'GET' });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user