Almost there

This commit is contained in:
Daniel Ledda
2020-11-14 16:18:27 +01:00
parent 73740fe114
commit e496296046

View File

@@ -45,17 +45,12 @@ class ClimateChart {
}
private async getInitialDataBlob(): Promise<SnapshotRecords> {
try {
const data = await fetch(this.rootUrl + "/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!");
}
return payload;
}
catch (e) {
throw e;
const data = await fetch(this.rootUrl + "/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!");
}
return payload;
}
private async initChart() {