Almost there

This commit is contained in:
Daniel Ledda
2020-11-14 16:43:08 +01:00
parent db4814025c
commit 6d9a315efe
2 changed files with 3 additions and 3 deletions

2
webapp/dist/main.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -93,7 +93,7 @@ class ClimateChart {
const url = "/" + this.rootUrl + "data?since=" + currentTime; const url = "/" + this.rootUrl + "data?since=" + currentTime;
try { try {
const payload: SnapshotRecords = await (await fetch(url)).json(); const payload: SnapshotRecords = await (await fetch(url)).json();
if (payload.snapshots.length > 0) { if (payload.snapshots.length > 0 && new Date(payload.snapshots[0].time).getTime() > Date.now()) {
this.latestSnapshot = payload.snapshots[0]; this.latestSnapshot = payload.snapshots[0];
this.removeExpiredData(currentTime); this.removeExpiredData(currentTime);
this.insertSnapshots(...payload.snapshots); this.insertSnapshots(...payload.snapshots);