diff --git a/web/src/App.svelte b/web/src/App.svelte
index 81f46f7..735459b 100644
--- a/web/src/App.svelte
+++ b/web/src/App.svelte
@@ -1,9 +1,11 @@
+
diff --git a/web/src/pages/Game.svelte b/web/src/pages/Game.svelte
index 2f863b8..48ee3e0 100644
--- a/web/src/pages/Game.svelte
+++ b/web/src/pages/Game.svelte
@@ -4,9 +4,11 @@
import { onMount } from "svelte";
import type { GetGameQuery } from "../gql/graphql";
- let { gameID } : {
- gameID: string
- } = $props()
+ let {
+ gameID,
+ }: {
+ gameID: string;
+ } = $props();
const doc = graphql(`
query getGame($gameID: ID!) {
@@ -31,17 +33,13 @@
`);
let loading = $state(true);
- let data: GetGameQuery | undefined = $state(undefined);
+ let data: GetGameQuery | undefined = $state();
onMount(() => {
- request("http://localhost:5173/graphql", doc, { gameID }).then(
- (e) => {
- console.log(e.game);
-
- data = e;
- loading = false;
- },
- );
+ request("http://localhost:5173/graphql", doc, { gameID }).then((e) => {
+ data = e;
+ loading = false;
+ });
});
@@ -49,6 +47,8 @@
{#if loading}
Loading...
+{:else if data == null || data.game == null}
+ Game not found.
{:else}
- {data?.game?.score}
+ {data.game.score}
{/if}
diff --git a/web/src/pages/Player.svelte b/web/src/pages/Player.svelte
index f9710a1..c27b005 100644
--- a/web/src/pages/Player.svelte
+++ b/web/src/pages/Player.svelte
@@ -1,10 +1,42 @@
Player
+{#if loading}
+ Loading...
+{:else if data == null || data.player == null}
+ Player not found.
+{:else}
+ {data.player.ID}
+{/if}