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