From db45cea37e8070e1572cdc25121c46022780f51d Mon Sep 17 00:00:00 2001
From: Ilion Beyst <ilion.beyst@gmail.com>
Date: Wed, 2 Feb 2022 19:36:18 +0100
Subject: temporary setup for showing submission match result

---
 web/pw-server/src/routes/index.svelte | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

(limited to 'web/pw-server/src/routes/index.svelte')

diff --git a/web/pw-server/src/routes/index.svelte b/web/pw-server/src/routes/index.svelte
index 0e811b3..a2a2e61 100644
--- a/web/pw-server/src/routes/index.svelte
+++ b/web/pw-server/src/routes/index.svelte
@@ -1,4 +1,6 @@
 <script lang="ts">
+  import { goto } from "$app/navigation";
+
   let code = "";
 
   async function submitCode() {
@@ -9,7 +11,7 @@
         "Content-Type": "application/json",
       },
       body: JSON.stringify({
-        "code": code,
+        code: code,
       }),
     });
 
@@ -17,11 +19,12 @@
       throw Error(response.statusText);
     }
 
-    let responseData = await response.json()
-    console.log(responseData);
+    let responseData = await response.json();
+    let matchId = responseData["match_id"];
+    goto(`/submission_matches/${matchId}`);
   }
 </script>
 
 <h1>Planetwars</h1>
 <textarea bind:value={code} />
-<button on:click={submitCode}>Submit</button>
\ No newline at end of file
+<button on:click={submitCode}>Submit</button>
-- 
cgit v1.2.3

