aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server/src
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-01-30 23:34:21 +0100
committerIlion Beyst <ilion.beyst@gmail.com>2022-02-02 18:29:17 +0100
commit2e3606f1b6ba59975b3a0141ed3b2f6286c66ec3 (patch)
treeae1859e86a4d2366dd1e994312e383273c4ccbc1 /web/pw-server/src
parentbfbcc173f88c67bc8e6b3a8079204739f72e7ebc (diff)
downloadplanetwars.dev-2e3606f1b6ba59975b3a0141ed3b2f6286c66ec3.tar.xz
planetwars.dev-2e3606f1b6ba59975b3a0141ed3b2f6286c66ec3.zip
get started on submit page
Diffstat (limited to 'web/pw-server/src')
-rw-r--r--web/pw-server/src/routes/index.svelte29
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