From 41f1679ef46238aff86e1811f73007b88eb4d53b Mon Sep 17 00:00:00 2001
From: Ilion Beyst <ilion.beyst@gmail.com>
Date: Mon, 25 Apr 2022 19:47:31 +0200
Subject: persist saved bot name

---
 web/pw-server/src/lib/components/SubmitPane.svelte | 4 ++++
 1 file changed, 4 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 4d5172e..20a6a39 100644
--- a/web/pw-server/src/lib/components/SubmitPane.svelte
+++ b/web/pw-server/src/lib/components/SubmitPane.svelte
@@ -1,5 +1,6 @@
 <script lang="ts">
   import { get_session_token } from "$lib/auth";
+  import { getBotName, saveBotName } from "$lib/bot_code";
 
   import { currentUser } from "$lib/stores/current_user";
   import { createEventDispatcher, onMount } from "svelte";
@@ -14,6 +15,8 @@
   let saveErrors: string[] = [];
 
   onMount(async () => {
+    botName = getBotName();
+
     const res = await fetch("/api/bots", {
       headers: {
         "Content-Type": "application/json",
@@ -68,6 +71,7 @@
     let responseData = await response.json();
     if (response.ok) {
       dispatch("botSaved", responseData);
+      saveBotName(botName);
       // clear errors
       saveErrors = [];
     } else {
-- 
cgit v1.2.3

