- graph, dotenv read
- graph, cors and secure header - web, urql client basic setup
This commit is contained in:
@@ -1,10 +1,24 @@
|
||||
<script lang="ts">
|
||||
import { beforeNavigate } from '$app/navigation';
|
||||
import { updated } from '$app/stores';
|
||||
import { setContextClient } from '@urql/svelte';
|
||||
import { newClient } from '$lib/client';
|
||||
import { newClient } from '$lib/gql/client';
|
||||
import '../app.css';
|
||||
import { Me } from '$lib/gql/auth.gql';
|
||||
|
||||
const { children } = $props();
|
||||
setContextClient(newClient(import.meta.env.VITE_GRAPH_URL ?? ''));
|
||||
const host = import.meta.env.VITE_GRAPH_URL ?? ''
|
||||
const client = newClient(`${host}/query`);
|
||||
|
||||
setContextClient(client);
|
||||
|
||||
beforeNavigate(({ willUnload, to }) => {
|
||||
if ($updated && !willUnload && to?.url) {
|
||||
location.href = to.url.href;
|
||||
}
|
||||
});
|
||||
|
||||
const p = client.query(Me, {}).toPromise();
|
||||
</script>
|
||||
|
||||
{@render children()}
|
||||
|
Reference in New Issue
Block a user