From 41f1679ef46238aff86e1811f73007b88eb4d53b Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Mon, 25 Apr 2022 19:47:31 +0200 Subject: persist saved bot name --- web/pw-server/src/lib/bot_code.ts | 9 +++++++++ web/pw-server/src/lib/components/SubmitPane.svelte | 4 ++++ 2 files changed, 13 insertions(+) (limited to 'web') diff --git a/web/pw-server/src/lib/bot_code.ts b/web/pw-server/src/lib/bot_code.ts index 688587e..29eac68 100644 --- a/web/pw-server/src/lib/bot_code.ts +++ b/web/pw-server/src/lib/bot_code.ts @@ -1,6 +1,7 @@ import defaultBotCode from "../assets/bot_template.txt?raw"; const BOT_CODE_KEY = "bot_code"; +const BOT_NAME_KEY = "bot_name"; export function getBotCode(): string { let botCode = localStorage.getItem(BOT_CODE_KEY); @@ -17,3 +18,11 @@ export function hasBotCode(): boolean { export function saveBotCode(botCode: string) { localStorage.setItem(BOT_CODE_KEY, botCode); } + +export function getBotName(): string | null { + return localStorage.getItem(BOT_NAME_KEY); +} + +export function saveBotName(name: string) { + localStorage.setItem(BOT_NAME_KEY, name); +} 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 @@