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 () => {