From 9f24a6184e6b63346aea33373b10a92e86b31225 Mon Sep 17 00:00:00 2001
From: Ilion Beyst <ilion.beyst@gmail.com>
Date: Mon, 25 Apr 2022 19:59:43 +0200
Subject: add saved bot to opponent list

---
 web/pw-server/src/lib/components/SubmitPane.svelte | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'web/pw-server/src/lib/components/SubmitPane.svelte')

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 {
-- 
cgit v1.2.3

