Files
wp-headless/wp-content/themes/moonshine/app/pages/[...uri].vue
Pascal Martineau c6dfbeb247
Some checks failed
Deployment / wordpress (push) Failing after 1s
Deployment / nuxt (push) Failing after 7s
feat: Deploy to Cloudflare workers
2026-01-27 19:59:34 -05:00

21 lines
760 B
Vue

<script setup lang="ts">
// Resolve Node component from URI
const { path: uri } = useRoute();
const { data } = await useAsyncGraphQLQuery("NodeByUri", { uri });
if (!data.value?.nodeByUri) {
throw createError({ statusCode: 404, message: `La page demandée est introuvable: ${uri}`, fatal: true });
}
const componentName = `Node${data.value.nodeByUri.__typename}`;
if (!useNuxtApp().vueApp.component(componentName)) {
throw createError({ statusCode: 404, message: `La page demandée ne peut pas être affichée correctement: ${componentName}`, fatal: true });
}
useNodeSeo(data.value.nodeByUri);
</script>
<template>
<div v-if="data?.nodeByUri" id="page-node-from-uri">
<Component :is="componentName" v-bind="data.nodeByUri" />
</div>
</template>