Redirect to dashboard when accessing frontpage while logged in
This commit is contained in:
parent
0c532fb979
commit
96fe8a4cdf
@ -4,6 +4,13 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<title>Temperature Alarm</title>
|
<title>Temperature Alarm</title>
|
||||||
<link rel="stylesheet" href="/styles/frontpage.css">
|
<link rel="stylesheet" href="/styles/frontpage.css">
|
||||||
|
<script type="module">
|
||||||
|
import { isLoggedIn } from "./shared/utils.js";
|
||||||
|
|
||||||
|
if (isLoggedIn()) {
|
||||||
|
location.href = "/home";
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<main>
|
||||||
|
@ -50,3 +50,7 @@ export function getUser() {
|
|||||||
return JSON.parse(localStorage.getItem("user"));
|
return JSON.parse(localStorage.getItem("user"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isLoggedIn() {
|
||||||
|
return document.cookie.match(/\bauth-token=/) && localStorage.getItem("user");
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user