generated from pascalmartineau/wp-skeleton
feat: Routes de l'arborescence
All checks were successful
Deploy WordPress and Nuxt / deploy (push) Successful in 57s
All checks were successful
Deploy WordPress and Nuxt / deploy (push) Successful in 57s
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
fragment TheArticle on Post {
|
||||
title
|
||||
}
|
||||
11
wp-content/themes/ccat/app/components/nodes/TheArticle.vue
Normal file
11
wp-content/themes/ccat/app/components/nodes/TheArticle.vue
Normal file
@@ -0,0 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { TheArticleFragment } from "#graphql-operations";
|
||||
|
||||
defineProps<{ node: TheArticleFragment }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UPage>
|
||||
<UPageSection v-if="node.title" :title="node.title" />
|
||||
</UPage>
|
||||
</template>
|
||||
@@ -0,0 +1,3 @@
|
||||
fragment TheEvent on Event {
|
||||
title
|
||||
}
|
||||
11
wp-content/themes/ccat/app/components/nodes/TheEvent.vue
Normal file
11
wp-content/themes/ccat/app/components/nodes/TheEvent.vue
Normal file
@@ -0,0 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { TheEventFragment } from "#graphql-operations";
|
||||
|
||||
defineProps<{ node: TheEventFragment }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UPage>
|
||||
<UPageSection v-if="node.title" :title="node.title" />
|
||||
</UPage>
|
||||
</template>
|
||||
@@ -0,0 +1,3 @@
|
||||
fragment TheLocation on Location {
|
||||
title
|
||||
}
|
||||
11
wp-content/themes/ccat/app/components/nodes/TheLocation.vue
Normal file
11
wp-content/themes/ccat/app/components/nodes/TheLocation.vue
Normal file
@@ -0,0 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { TheLocationFragment } from "#graphql-operations";
|
||||
|
||||
defineProps<{ node: TheLocationFragment }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UPage>
|
||||
<UPageSection v-if="node.title" :title="node.title" />
|
||||
</UPage>
|
||||
</template>
|
||||
@@ -0,0 +1,3 @@
|
||||
fragment TheMembership on Membership {
|
||||
title
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { TheMembershipFragment } from "#graphql-operations";
|
||||
|
||||
defineProps<{ node: TheMembershipFragment }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UPage>
|
||||
<UPageSection v-if="node.title" :title="node.title" />
|
||||
</UPage>
|
||||
</template>
|
||||
@@ -0,0 +1,3 @@
|
||||
fragment TheProject on Project {
|
||||
title
|
||||
}
|
||||
11
wp-content/themes/ccat/app/components/nodes/TheProject.vue
Normal file
11
wp-content/themes/ccat/app/components/nodes/TheProject.vue
Normal file
@@ -0,0 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { TheProjectFragment } from "#graphql-operations";
|
||||
|
||||
defineProps<{ node: TheProjectFragment }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UPage>
|
||||
<UPageSection v-if="node.title" :title="node.title" />
|
||||
</UPage>
|
||||
</template>
|
||||
@@ -0,0 +1,3 @@
|
||||
fragment TheResource on Resource {
|
||||
title
|
||||
}
|
||||
11
wp-content/themes/ccat/app/components/nodes/TheResource.vue
Normal file
11
wp-content/themes/ccat/app/components/nodes/TheResource.vue
Normal file
@@ -0,0 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { TheResourceFragment } from "#graphql-operations";
|
||||
|
||||
defineProps<{ node: TheResourceFragment }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UPage>
|
||||
<UPageSection v-if="node.title" :title="node.title" />
|
||||
</UPage>
|
||||
</template>
|
||||
@@ -5,5 +5,23 @@ query nodeByUri($uri: String!) {
|
||||
... on Page {
|
||||
...ThePage
|
||||
}
|
||||
... on Post {
|
||||
...TheArticle
|
||||
}
|
||||
... on Event {
|
||||
...TheEvent
|
||||
}
|
||||
... on Location {
|
||||
...TheLocation
|
||||
}
|
||||
... on Membership {
|
||||
...TheMembership
|
||||
}
|
||||
... on Project {
|
||||
...TheProject
|
||||
}
|
||||
... on Resource {
|
||||
...TheResource
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,21 @@
|
||||
import type { ThePageFragment } from "#graphql-operations";
|
||||
import { ThePage } from "#components";
|
||||
import type {
|
||||
ThePageFragment,
|
||||
TheArticleFragment,
|
||||
TheEventFragment,
|
||||
TheLocationFragment,
|
||||
TheMembershipFragment,
|
||||
TheProjectFragment,
|
||||
TheResourceFragment,
|
||||
} from "#graphql-operations";
|
||||
import {
|
||||
ThePage,
|
||||
TheArticle,
|
||||
TheEvent,
|
||||
TheLocation,
|
||||
TheMembership,
|
||||
TheProject,
|
||||
TheResource,
|
||||
} from "#components";
|
||||
|
||||
export async function useNodeByUri() {
|
||||
const route = useRoute();
|
||||
@@ -12,6 +28,18 @@ export async function useNodeByUri() {
|
||||
switch (node?.__typename) {
|
||||
case "Page":
|
||||
return { component: ThePage, node: node as ThePageFragment };
|
||||
case "Post":
|
||||
return { component: TheArticle, node: node as TheArticleFragment };
|
||||
case "Event":
|
||||
return { component: TheEvent, node: node as TheEventFragment };
|
||||
case "Location":
|
||||
return { component: TheLocation, node: node as TheLocationFragment };
|
||||
case "Membership":
|
||||
return { component: TheMembership, node: node as TheMembershipFragment };
|
||||
case "Project":
|
||||
return { component: TheProject, node: node as TheProjectFragment };
|
||||
case "Resource":
|
||||
return { component: TheResource, node: node as TheResourceFragment };
|
||||
default:
|
||||
throw createError({ statusCode: 404, message: "Page non trouvée", fatal: true });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user