refactor: update to nuxt-graphql 0.5.x

This commit is contained in:
2026-01-20 10:09:44 -05:00
parent 684e2fa1e9
commit e383255e73
14 changed files with 973 additions and 2113 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { BuilderSectionsFragment } from "#graphql/typed-documents";
import type { BuilderSectionsFragment } from "#graphql/fragments";
const props = defineProps<BuilderSectionsFragment>();
const sections = computed(() => {

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { LayoutContainedFragment } from "#graphql/typed-documents";
import type { LayoutContainedFragment } from "#graphql/fragments";
import { tv, type VariantProps } from "tailwind-variants";
const props = defineProps<LayoutContainedFragment>();

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { NodePageFragment } from "#graphql/typed-documents";
import type { NodePageFragment } from "#graphql/fragments";
defineProps<NodePageFragment>();
</script>

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { SectionTextBlockFragment } from "#graphql/typed-documents";
import type { SectionTextBlockFragment } from "#graphql/fragments";
defineProps<SectionTextBlockFragment>();
</script>

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
const { data } = await useGraphQLQuery("GeneralSettings", undefined, { cache: { ttl: 0 } });
const { data } = await useAsyncGraphQLQuery("GeneralSettings", undefined, { cache: { ttl: 0 } });
</script>
<template>

View File

@@ -28,7 +28,7 @@ export function useAuthConnexion() {
async function login({ data: variables }: FormSubmitEvent<AuthLoginForm>, redirect?: string) {
try {
const { data } = await loginMutate(variables);
if (!data.login) {
if (!data?.login) {
throw new Error(`Échec de la connexion par mot de passe.`);
}
await redirectTo(redirect);

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
const { path: uri } = useRoute();
const { data } = await useGraphQLQuery("NodeByUri", { uri });
const { data } = await useAsyncGraphQLQuery("NodeByUri", { uri });
// Resolve and validate Node component
if (!data.value.nodeByUri) {