From 8cec114c0c0feeab4d8ba144f6cf3a2b1b30d3ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFs=20Boubault?=
<7613286+Applelo@users.noreply.github.com>
Date: Sat, 1 Jun 2024 14:17:00 +0200
Subject: [PATCH] fix result gen
---
components/Result.vue | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/components/Result.vue b/components/Result.vue
index 1af7d9c..73388d4 100644
--- a/components/Result.vue
+++ b/components/Result.vue
@@ -4,17 +4,20 @@ const props = defineProps<{
loading: boolean
}>()
+const body = computed(() => {
+ return {
+ schema: props.rawSchema,
+ }
+})
const selected = ref(0)
-const {data: rawTs, execute: executeGqlToTs } = await useFetch('/api/gql-to-ts', {
+const { data: rawTs, execute: executeGqlToTs } = await useFetch('/api/gql-to-ts', {
method: 'POST',
- body: {
- schema: props.rawSchema,
- },
+ body,
immediate: false,
- server: false
+ server: false,
+ watch: false,
})
-
const items = [{
label: 'Schema',
}, {
@@ -29,14 +32,14 @@ function codeToClipboard() {
copy(props.rawSchema)
toast.add({
title: 'Copied',
- description: 'The schema is in your clipboard!'
+ description: 'The schema is in your clipboard!',
})
}
else if (selected.value === 1 && rawTs.value) {
copy(rawTs.value)
toast.add({
title: 'Copied',
- description: 'The TypeScript code is in your clipboard!'
+ description: 'The TypeScript code is in your clipboard!',
})
}
}
@@ -65,10 +68,10 @@ watch(selected, async () => {