From 5f2c464c9a6a142dd023627a73dc923a5f5484f3 Mon Sep 17 00:00:00 2001 From: Pascal Martineau Date: Wed, 24 Sep 2025 15:16:20 -0400 Subject: [PATCH] refactor: shared useSection --- wp-content/themes/ccat/app/composables/useSection.ts | 12 ------------ .../ccat/{server => shared}/utils/useSection.ts | 0 2 files changed, 12 deletions(-) delete mode 100644 wp-content/themes/ccat/app/composables/useSection.ts rename wp-content/themes/ccat/{server => shared}/utils/useSection.ts (100%) diff --git a/wp-content/themes/ccat/app/composables/useSection.ts b/wp-content/themes/ccat/app/composables/useSection.ts deleted file mode 100644 index cbe3f1a..0000000 --- a/wp-content/themes/ccat/app/composables/useSection.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { TheSectionFragment } from "#graphql-operations"; -import { SectionTextBlock } from "#components"; - -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 }; -} diff --git a/wp-content/themes/ccat/server/utils/useSection.ts b/wp-content/themes/ccat/shared/utils/useSection.ts similarity index 100% rename from wp-content/themes/ccat/server/utils/useSection.ts rename to wp-content/themes/ccat/shared/utils/useSection.ts