Almost there
This commit is contained in:
@@ -45,7 +45,7 @@ class ClimateChart {
|
||||
}
|
||||
|
||||
private async getInitialDataBlob(): Promise<SnapshotRecords> {
|
||||
const data = await fetch(this.rootUrl + "/data?since=" + new Date((new Date().getTime() - this.minutesDisplayed * 60 * 1000)).toISOString());
|
||||
const data = await fetch("data?since=" + new Date((new Date().getTime() - this.minutesDisplayed * 60 * 1000)).toISOString());
|
||||
const payload = await data.json();
|
||||
if (payload.snapshots.length < 0) {
|
||||
throw new Error("Bad response - no snapshots found!");
|
||||
@@ -90,7 +90,7 @@ class ClimateChart {
|
||||
|
||||
private async updateFromServer() {
|
||||
const currentTime = (new Date(this.latestSnapshot.time)).toISOString();
|
||||
const url = "/" + this.rootUrl + "data?since=" + currentTime;
|
||||
const url = "data?since=" + currentTime;
|
||||
try {
|
||||
const payload: SnapshotRecords = await (await fetch(url)).json();
|
||||
if (payload.snapshots.length > 0 && new Date(payload.snapshots[0].time).getTime() > Date.now()) {
|
||||
|
||||
Reference in New Issue
Block a user