generated from pascalmartineau/wp-skeleton
wip: refactor sections
This commit is contained in:
@@ -3,11 +3,12 @@ import { createSSRApp, h } from "vue";
|
||||
import type { TheSectionFragment } from "#graphql-operations";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const { fieldGroupName, ...attrs } = await readBody<TheSectionFragment>(event);
|
||||
try {
|
||||
const section = await readBody<TheSectionFragment>(event);
|
||||
const { component, attrs } = useSection(section);
|
||||
const app = createSSRApp({
|
||||
render() {
|
||||
return h(sectionsMap[fieldGroupName as FieldGroupName], attrs);
|
||||
return h(component, attrs);
|
||||
},
|
||||
});
|
||||
const html = await renderToString(app);
|
||||
|
||||
Reference in New Issue
Block a user