added the Todos query

This commit is contained in:
Samuel Andert 2023-08-25 11:50:36 +02:00
parent 842cd376cc
commit 8d4b217c99
4 changed files with 13 additions and 9 deletions

View File

@ -1,6 +1,10 @@
query Projects { query Todos {
directus_todos { directus_todos {
id id
task task
user_created {
first_name
last_name
}
} }
} }

View File

@ -1,7 +1,6 @@
import axios from 'axios'; import axios from 'axios';
import fs from 'fs'; import fs from 'fs';
import dotenv from 'dotenv'; import dotenv from 'dotenv';
dotenv.config(); dotenv.config();
export async function fetchSchemas() { export async function fetchSchemas() {

View File

@ -20,7 +20,8 @@ const directus = introspect.graphql({
apiNamespace: 'directus', apiNamespace: 'directus',
loadSchemaFromString: directusSchema, loadSchemaFromString: directusSchema,
url: 'https://directus.andert.me/graphql', url: 'https://directus.andert.me/graphql',
headers: (builder) => builder.addStaticHeader('Authorization', 'Bearer Bv5RknRvv5AZouxcYdBJgVOe3ZC493Y3') headers: (builder) => builder
.addStaticHeader('Authorization', 'Bearer Bv5RknRvv5AZouxcYdBJgVOe3ZC493Y3')
}); });
// configureWunderGraph emits the configuration // configureWunderGraph emits the configuration

View File

@ -1,9 +1,9 @@
<script lang="ts"> <script lang="ts">
import { createQuery } from "../lib/wundergraph"; import { createQuery } from "../lib/wundergraph";
const dragonsQuery = createQuery({ // const dragonsQuery = createQuery({
operationName: "Dragons", // operationName: "Dragons",
}); // });
const projectsQuery = createQuery({ const projectsQuery = createQuery({
operationName: "Projects", operationName: "Projects",
}); });
@ -12,7 +12,7 @@
}); });
</script> </script>
Dragons <!-- Dragons
<div class="results"> <div class="results">
{#if $dragonsQuery.isLoading} {#if $dragonsQuery.isLoading}
<p>Loading...</p> <p>Loading...</p>
@ -21,7 +21,7 @@ Dragons
{:else} {:else}
<pre>{JSON.stringify($dragonsQuery.data, null, 2)}</pre> <pre>{JSON.stringify($dragonsQuery.data, null, 2)}</pre>
{/if} {/if}
</div> </div> -->
Projects Projects
<div class="results"> <div class="results">
@ -34,7 +34,7 @@ Projects
{/if} {/if}
</div> </div>
Tasks Todos
<div class="results"> <div class="results">
{#if $todosQuery.isLoading} {#if $todosQuery.isLoading}
<p>Loading...</p> <p>Loading...</p>