mirror of
https://github.com/Roslund/sthlm-mesh.git
synced 2026-10-30 23:41:58 +01:00
deploy: b39de31c75
This commit is contained in:
1 parent
e94206217f
commit
7e5bb259f2
1 file changed
+2
-1
@@ -35,7 +35,8 @@
|
||||
|
||||
async function fetchDeviceMetrics(nodeId) {
|
||||
const base = `https://map.sthlm-mesh.se/api/v1/nodes/${nodeId}/device-metrics`;
|
||||
const res = await fetch(`${base}?days=${encodeURIComponent(DAYS)}`);
|
||||
const timeFromMs = Date.now() - (DAYS * 24 * 60 * 60 * 1000);
|
||||
const res = await fetch(`${base}?time_from=${encodeURIComponent(timeFromMs)}`);
|
||||
if (!res.ok) throw new Error(`Failed to fetch metrics for ${nodeId}`);
|
||||
const data = await res.json();
|
||||
if (Array.isArray(data)) return data;
|
||||
|
||||
Reference in new issue
Block a user