Surface revision-payload FAQs on the pending card so admins can review another host's FAQ changes alongside title/slug.
29 lines
1.1 KiB
TypeScript
29 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 — after backend admin bypass on list reads,
|
|
* authenticated admins can load media/FAQs for any non-deleted event
|
|
* (detail + edit pages for another host's event).
|
|
*/
|
|
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[]) : []
|
|
}
|