added in graphql client

This commit is contained in:
2024-11-01 23:19:56 +05:30
parent 1fb2d7d154
commit 46c46a7e71
29 changed files with 2453 additions and 585 deletions

8
web/lib/client.ts Normal file
View File

@@ -0,0 +1,8 @@
import { Client, cacheExchange, fetchExchange } from '@urql/svelte';
export function newClient(url: string) {
return new Client({
url,
exchanges: [cacheExchange, fetchExchange]
});
}

View File

@@ -1,5 +0,0 @@
import { HoudiniClient } from '$houdini';
export default new HoudiniClient({
url: process.env.GRAPH_HOST
});

View File

@@ -1,3 +0,0 @@
export function hello() {
console.log("hello");
}

View File

View File

@@ -0,0 +1 @@
export let authUser = $state();

View File

@@ -1,6 +1,10 @@
<script>
import "../app.css";
const { children } = $props();
<script lang="ts">
import { setContextClient } from '@urql/svelte';
import { newClient } from '$lib/client';
import '../app.css';
const { children } = $props();
setContextClient(newClient(import.meta.env.VITE_GRAPH_URL ?? ''));
</script>
{@render children()}