Compare commits
3 Commits
9529d2cdc8
...
28cffcfb42
Author | SHA1 | Date | |
---|---|---|---|
28cffcfb42 | |||
96fe8a4cdf | |||
0c532fb979 |
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="topnav">
|
<div class="topnav">
|
||||||
<a class="active" href="/home/index.html">Home</a>
|
<a class="active" href="/home">Home</a>
|
||||||
<div style="display: flex; justify-content: flex-end;">
|
<div style="display: flex; justify-content: flex-end;">
|
||||||
<a href="/devices">Devices</a>
|
<a href="/devices">Devices</a>
|
||||||
<a href="/profile">Profile</a>
|
<a href="/profile">Profile</a>
|
||||||
|
@ -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>
|
||||||
|
@ -115,10 +115,10 @@ async function init() {
|
|||||||
x: new Date(log.date).getTime(),
|
x: new Date(log.date).getTime(),
|
||||||
y: log.temperature,
|
y: log.temperature,
|
||||||
})),
|
})),
|
||||||
parsing: false,
|
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
|
parsing: false,
|
||||||
plugins: {
|
plugins: {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
callbacks: {
|
callbacks: {
|
||||||
@ -127,6 +127,8 @@ async function init() {
|
|||||||
},
|
},
|
||||||
decimation: {
|
decimation: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
algorithm: "lttb",
|
||||||
|
samples: window.innerWidth / 2,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
scales: {
|
scales: {
|
||||||
|
@ -16,6 +16,10 @@ export async function request(method, path, body = null) {
|
|||||||
body: body ? JSON.stringify(body) : undefined,
|
body: body ? JSON.stringify(body) : undefined,
|
||||||
})
|
})
|
||||||
.then(async response => {
|
.then(async response => {
|
||||||
|
if (response.status === 401) {
|
||||||
|
location.href = "/login";
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
|
|
||||||
@ -46,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