From 96fe8a4cdf75ab04fd3878d22da5a2942d92ffeb Mon Sep 17 00:00:00 2001 From: Reimar Date: Tue, 1 Apr 2025 13:39:13 +0200 Subject: [PATCH] Redirect to dashboard when accessing frontpage while logged in --- frontend/index.html | 7 +++++++ frontend/shared/utils.js | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/frontend/index.html b/frontend/index.html index c30d98b..bbd252d 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -4,6 +4,13 @@ Temperature Alarm +
diff --git a/frontend/shared/utils.js b/frontend/shared/utils.js index 3bbd6c1..2493d3a 100644 --- a/frontend/shared/utils.js +++ b/frontend/shared/utils.js @@ -50,3 +50,7 @@ export function getUser() { return JSON.parse(localStorage.getItem("user")); } +export function isLoggedIn() { + return document.cookie.match(/\bauth-token=/) && localStorage.getItem("user"); +} +