wip: refactor sections

This commit is contained in:
2025-09-24 15:14:48 -04:00
parent b2b9b2ba8f
commit 9af11d00cf
9 changed files with 56 additions and 59 deletions

View File

@@ -1,15 +0,0 @@
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 };
}