From 8cda16d1c9b57ce2b49983b79afd09c8d2320477 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sat, 23 Apr 2022 11:28:40 +0200 Subject: show rules on first visit --- web/pw-server/src/lib/bot_code.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'web/pw-server/src/lib/bot_code.ts') diff --git a/web/pw-server/src/lib/bot_code.ts b/web/pw-server/src/lib/bot_code.ts index 088db72..688587e 100644 --- a/web/pw-server/src/lib/bot_code.ts +++ b/web/pw-server/src/lib/bot_code.ts @@ -2,7 +2,7 @@ import defaultBotCode from "../assets/bot_template.txt?raw"; const BOT_CODE_KEY = "bot_code"; -export function getBotCode() { +export function getBotCode(): string { let botCode = localStorage.getItem(BOT_CODE_KEY); if (!botCode) { botCode = defaultBotCode; @@ -10,6 +10,10 @@ export function getBotCode() { return botCode; } +export function hasBotCode(): boolean { + return !!localStorage.getItem(BOT_CODE_KEY); +} + export function saveBotCode(botCode: string) { localStorage.setItem(BOT_CODE_KEY, botCode); } -- cgit v1.2.3