mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-13 15:37:03 +00:00
Fixed runaway price update
This commit is contained in:
parent
3af19c9b15
commit
88ddc6ea15
18
lib/SvelteUi/app/dist/index.js
vendored
18
lib/SvelteUi/app/dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -121,13 +121,17 @@ export async function shiftPrices() {
|
||||
});
|
||||
if(fetchUpdate) {
|
||||
getPrices();
|
||||
} else {
|
||||
let date = new Date();
|
||||
priceShiftTimeout = setTimeout(shiftPrices, ((60-date.getMinutes())*60000))
|
||||
}
|
||||
|
||||
let date = new Date();
|
||||
priceShiftTimeout = setTimeout(shiftPrices, ((60-date.getMinutes())*60000))
|
||||
}
|
||||
|
||||
export async function getPrices() {
|
||||
if(priceShiftTimeout) {
|
||||
clearTimeout(priceShiftTimeout);
|
||||
priceShiftTimeout = 0;
|
||||
}
|
||||
const response = await fetchWithTimeout("/energyprice.json");
|
||||
prices = (await response.json())
|
||||
pricesStore.set(prices);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user