aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server/src
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-04-25 19:59:43 +0200
committerIlion Beyst <ilion.beyst@gmail.com>2022-04-25 19:59:43 +0200
commit9f24a6184e6b63346aea33373b10a92e86b31225 (patch)
tree7ba75b06e3bc954d9b649b11d4af70d9887b5065 /web/pw-server/src
parent41f1679ef46238aff86e1811f73007b88eb4d53b (diff)
downloadplanetwars.dev-9f24a6184e6b63346aea33373b10a92e86b31225.tar.xz
planetwars.dev-9f24a6184e6b63346aea33373b10a92e86b31225.zip
add saved bot to opponent list
Diffstat (limited to 'web/pw-server/src')
-rw-r--r--web/pw-server/src/lib/components/SubmitPane.svelte5
1 files changed, 5 insertions, 0 deletions
diff --git a/web/pw-server/src/lib/components/SubmitPane.svelte b/web/pw-server/src/lib/components/SubmitPane.svelte
index 20a6a39..740f2cf 100644
--- a/web/pw-server/src/lib/components/SubmitPane.svelte
+++ b/web/pw-server/src/lib/components/SubmitPane.svelte
@@ -72,6 +72,11 @@
if (response.ok) {
dispatch("botSaved", responseData);
saveBotName(botName);
+
+ // make bot available in available bot list
+ if (!availableBots.find((bot) => bot["id"] == responseData["id"])) {
+ availableBots = [...availableBots, responseData];
+ }
// clear errors
saveErrors = [];
} else {