Almost there
This commit is contained in:
2
webapp/dist/main.js
vendored
2
webapp/dist/main.js
vendored
File diff suppressed because one or more lines are too long
@@ -47,6 +47,10 @@ 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 await data.json();
|
||||
}
|
||||
catch (e) {
|
||||
|
||||
@@ -12,6 +12,7 @@ function createClimateChart() {
|
||||
const argsStart = pathname.search(/\?minute-span=/);
|
||||
if (argsStart !== -1) {
|
||||
const parsedMins = Number(pathname[12]);
|
||||
console.log(parsedMins);
|
||||
if (!isNaN(parsedMins) && parsedMins > 0) {
|
||||
minutesDisplayed = parsedMins;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user