Files
cultureat-bak/wp-content/themes/ccat/shared/utils/useSection.ts
Pascal Martineau 5f2c464c9a
All checks were successful
Deploy WordPress and Nuxt / deploy (push) Successful in 59s
refactor: shared useSection
2025-09-24 15:16:20 -04:00

13 lines
548 B
TypeScript

import type { TheSectionFragment } from "#graphql-operations";
import SectionTextBlock from "~/components/sections/SectionTextBlock.vue";
const sections = {
GroupAbstractBuilderSectionsTextBlockLayout: SectionTextBlock,
} as const;
export function useSection({ fieldGroupName, ...attrs }: TheSectionFragment) {
const component = sections[fieldGroupName as keyof typeof sections];
if (!component) throw createError({ statusCode: 500, statusMessage: "Erreur interne", message: "Type de section invalide." });
return { component, attrs };
}