Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
31 lines
1.2 KiB
TypeScript
31 lines
1.2 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()
|
|
|
|
/**
|
|
* `GET /events/:eventId/media` — public, unpaginated, ordered by `sortOrder` asc.
|
|
* See docs/workflows/fa/event-discovery.md, stage 3.
|
|
*/
|
|
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[]) : []
|
|
}
|
|
|
|
/**
|
|
* `GET /events/:eventId/faqs` — public, unpaginated, ordered by `sortOrder` asc.
|
|
*/
|
|
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[]) : []
|
|
}
|