admin/services/eventDetail.ts
alisaza 82593dc18c refactor(events): update event management components and remove unused files
- Replaced `LIST_PUBLIC_CATEGORIES` with `LIST_ADMIN_CATEGORIES_FLAT` in `ArticleFormModal.tsx`.
- Removed the "Add Event" button from the dashboard page.
- Simplified the `EventsPage` by removing the button and adjusting the layout.
- Cleaned up the `AdminEventEditPage` by removing unnecessary props.
- Deleted unused layout and page files related to event creation.
- Updated `AdminAuthContent` to use `useAdminCitiesQuery` instead of `useDiscoveryCitiesQuery`.
- Refactored `EventGuestListAccessPanel` to remove the `accessMode` prop and adjust API calls accordingly.
- Removed several unused components and tests related to event creation, enhancing project maintainability.
2026-09-07 18:09:55 +03:30

28 lines
1.1 KiB
TypeScript

import type { EventFaqResponseDto, EventMediaResponseDto, EventMediaType } from '@/api/generated/models'
import { getEventExtras } from '@/api/generated/event-extras/event-extras'
import { unwrapApiPayload } from '@/helpers/listResponse'
export type { EventMediaType }
export type EventMedia = EventMediaResponseDto
export type EventFaq = EventFaqResponseDto
const eventExtrasApi = getEventExtras()
/**
* Shared public list endpoints — backend allows admin reads for event detail/edit.
* No dedicated admin media/FAQ list routes exist in OpenAPI.
*/
export async function fetchEventMedia(eventId: string): Promise<EventMedia[]> {
const response = await eventExtrasApi.eventMediaControllerList(eventId)
const payload = unwrapApiPayload(response.data)
return Array.isArray(payload) ? (payload as EventMedia[]) : []
}
export async function fetchEventFaqs(eventId: string): Promise<EventFaq[]> {
const response = await eventExtrasApi.eventFaqsControllerList(eventId)
const payload = unwrapApiPayload(response.data)
return Array.isArray(payload) ? (payload as EventFaq[]) : []
}