blob: 0e811b3e0c68dbf4d966ef01053a379a3085e4e5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
<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>
|