generated from pascalmartineau/wp-skeleton
feat: Initial TheSections
This commit is contained in:
12
wp-content/themes/ccat/app/composables/useSection.ts
Normal file
12
wp-content/themes/ccat/app/composables/useSection.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { SectionTextBlockFragment, TheSectionFragment } from "#graphql-operations";
|
||||
import { SectionTextBlock } from "#components";
|
||||
|
||||
export function useSection(section: TheSectionFragment) {
|
||||
const { fieldGroupName, ...attrs } = section;
|
||||
switch (fieldGroupName) {
|
||||
case "GroupAbstractBuilderSectionsTextBlockLayout":
|
||||
return { component: SectionTextBlock, attrs: attrs as SectionTextBlockFragment };
|
||||
default:
|
||||
throw createError({ statusCode: 500, statusMessage: "Erreur interne", message: "Type de section invalide" });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user