import { useQuery } from '@tanstack/vue-query' import type { Ref } from 'vue' import { apiClient } from '@/lib/axios' import type { PublicFormSectionOption } from '@/composables/forms/types/formBuilder' interface ApiResponse { data: T } // Sibling endpoint for SECTION_PRIORITY — festival-aware and dedup-by-name // per PublicFormController::sections (show_in_registration=true, standard). export function usePublicFormSections(token: Ref) { return useQuery({ queryKey: ['public-form', token, 'sections'], queryFn: async (): Promise => { const t = token.value if (!t) throw new Error('Missing public_token') const { data } = await apiClient.get>( `/public/forms/${t}/sections`, ) return data.data }, enabled: computed(() => !!token.value), staleTime: 1000 * 60 * 5, }) }