Migrates the navbar (event/platform two-mode toggle), mobile drawer
with avatar header + logout, RouterView Suspense wrapper, and footer
from apps/portal/src/layouts/portal.vue into the PortalLayout.vue
skeleton from PR-A. The skeleton's structure (VApp / VAppBar / VMain
/ VFooter) is preserved as the outer shell.
Notable adaptations:
- useAuthStore → usePortalAuthStore (renamed in C.3)
- usePortalStore import path → @/stores/portal/usePortalStore
- mobile nav links now point at /portal/evenementen and /portal/profiel
(the new sub-zone paths) instead of /evenementen and /profiel
- explicit `import { useRoute, useRouter }` from vue-router so the
vitest mock can intercept (auto-import not configured for these in
the trimmed test config)
Updated PortalLayout.spec.ts to mock the two pinia stores plus
useSkins, vue-router, UserAvatarMenu, and AppLoadingIndicator. Tests
now assert the auth-conditional rendering: header + drawer hidden
when unauthenticated, main + footer always present.
Also pulls in the @form-schema → @/composables/forms/* import
rewrites in the C.4-moved composables that the previous commit's
rename-only diff left unstaged.
Vitest: 23 files / 162 tests, no errors.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
28 lines
917 B
TypeScript
28 lines
917 B
TypeScript
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<T> {
|
|
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<string>) {
|
|
return useQuery({
|
|
queryKey: ['public-form', token, 'sections'],
|
|
queryFn: async (): Promise<PublicFormSectionOption[]> => {
|
|
const t = token.value
|
|
if (!t) throw new Error('Missing public_token')
|
|
const { data } = await apiClient.get<ApiResponse<PublicFormSectionOption[]>>(
|
|
`/public/forms/${t}/sections`,
|
|
)
|
|
|
|
return data.data
|
|
},
|
|
enabled: computed(() => !!token.value),
|
|
staleTime: 1000 * 60 * 5,
|
|
})
|
|
}
|