mirror of
https://github.com/bendtherules/mispair-demo.git
synced 2026-08-18 13:22:17 +00:00
Init file
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
node_modules/
|
||||
/.pnp
|
||||
.pnp.js
|
||||
.DS_Store
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
package-lock.json
|
||||
.env
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
async function fetchTemperature(zoneId) {
|
||||
const res = await fetch(`/api/v1/zones/${zoneId}/primary/temperature`);
|
||||
return res.json();
|
||||
}
|
||||
|
||||
// Don't change this function signature
|
||||
export async function attachChart(chartInstance, zoneId) {
|
||||
await fetchTemperature(zoneId).then(temp => {
|
||||
chartInstance.update(temp);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// This file can not be modified.
|
||||
// Each zone has one corresponding chart.
|
||||
// UI code calls attachChart for each zone and corresponding chart.
|
||||
import { attachChart } from './data.js';
|
||||
const zones = ['zone-a', 'zone-b', 'zone-c', /* ... */];
|
||||
for (const zoneId of zones) {
|
||||
const chart = createChartForZone(zoneId);
|
||||
attachChart(chart, zoneId);
|
||||
}
|
||||
Reference in New Issue
Block a user