aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server/src/lib/components/SubmitPane.svelte
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-03-05 12:10:41 +0100
committerIlion Beyst <ilion.beyst@gmail.com>2022-03-05 12:10:41 +0100
commit47ec2c6721c53ab047c43d75b16fbec9f8db5750 (patch)
treeb6a0a7bfa5559ad25d15da0f2708320b08e76f94 /web/pw-server/src/lib/components/SubmitPane.svelte
parentaf04709fe16ea9463179a0c3c11d227e83b548d1 (diff)
downloadplanetwars.dev-47ec2c6721c53ab047c43d75b16fbec9f8db5750.tar.xz
planetwars.dev-47ec2c6721c53ab047c43d75b16fbec9f8db5750.zip
fix opponent selection
Diffstat (limited to 'web/pw-server/src/lib/components/SubmitPane.svelte')
-rw-r--r--web/pw-server/src/lib/components/SubmitPane.svelte11
1 files changed, 5 insertions, 6 deletions
diff --git a/web/pw-server/src/lib/components/SubmitPane.svelte b/web/pw-server/src/lib/components/SubmitPane.svelte
index d647b46..588a5e7 100644
--- a/web/pw-server/src/lib/components/SubmitPane.svelte
+++ b/web/pw-server/src/lib/components/SubmitPane.svelte
@@ -3,12 +3,9 @@
import Select from "svelte-select";
let availableBots: object[] = [];
- let selectedOpponent = "simplebot";
+ let selectedOpponent = undefined;
let botName: string | undefined = undefined;
- const optionIdentifier = "name";
- const labelIdentifier = "name";
-
onMount(async () => {
const res = await fetch("/api/bots", {
headers: {
@@ -18,14 +15,16 @@
if (res.ok) {
availableBots = await res.json();
- console.log(availableBots);
+ selectedOpponent = availableBots.find((b) => b["name"] === "simplebot");
}
});
const dispatch = createEventDispatcher();
function submitBot() {
- dispatch("submitBot");
+ dispatch("submitBot", {
+ opponentName: selectedOpponent["name"],
+ });
}
function saveBot() {