diff options
Diffstat (limited to 'web/pw-server/src')
-rw-r--r-- | web/pw-server/src/routes/index.svelte | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/web/pw-server/src/routes/index.svelte b/web/pw-server/src/routes/index.svelte index 5982b0a..0e811b3 100644 --- a/web/pw-server/src/routes/index.svelte +++ b/web/pw-server/src/routes/index.svelte @@ -1,2 +1,27 @@ -<h1>Welcome to SvelteKit</h1> -<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p> +<script lang="ts"> + let code = ""; + + async function submitCode() { + console.log("click"); + let response = await fetch("/api/submit_bot", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + "code": code, + }), + }); + + if (!response.ok) { + throw Error(response.statusText); + } + + let responseData = await response.json() + console.log(responseData); + } +</script> + +<h1>Planetwars</h1> +<textarea bind:value={code} /> +<button on:click={submitCode}>Submit</button>
\ No newline at end of file |