diff --git a/server/scripts/modules/groundview.mjs b/server/scripts/modules/groundview.mjs index 2bb19a3..26d6c4e 100644 --- a/server/scripts/modules/groundview.mjs +++ b/server/scripts/modules/groundview.mjs @@ -12,12 +12,11 @@ class GroundView extends WeatherDisplay { } async getData(weatherParameters, refresh) { - const superResult = super.getData(weatherParameters, refresh); - this.setAutoReload(); + if (!super.getData(weatherParameters, refresh)) return; const requestToken = ++this.requestToken; if (!this.weatherParameters?.latitude || !this.weatherParameters?.longitude || !this.weatherParameters?.city) { this.setStatus(STATUS.noData); - return superResult; + return; } const url = new URL(withBasePath('api/ground-view'), window.location.origin); @@ -30,13 +29,13 @@ class GroundView extends WeatherDisplay { }); if (requestToken !== this.requestToken) { - return superResult; + return; } if (!response?.success) { this.data = null; this.setStatus(STATUS.failed); - return superResult; + return; } this.data = { @@ -44,7 +43,6 @@ class GroundView extends WeatherDisplay { hasWebcam: Boolean(response.webcam?.imageUrl), }; this.setStatus(STATUS.loaded); - return superResult; } resetViewState() { diff --git a/server/scripts/modules/hazard-list.mjs b/server/scripts/modules/hazard-list.mjs index aaae729..b36f05c 100644 --- a/server/scripts/modules/hazard-list.mjs +++ b/server/scripts/modules/hazard-list.mjs @@ -13,12 +13,12 @@ class HazardList extends WeatherDisplay { } async getData(weatherParameters, refresh) { - const superResult = super.getData(weatherParameters, refresh); + if (!super.getData(weatherParameters, refresh)) return; await this.refreshHistoryNow(); - return superResult; } async refreshHistoryNow() { + if (!this.isEnabled) return; try { // Fetch hazard history from backend const response = await fetch(withBasePath('api/hazard-history')); diff --git a/server/scripts/modules/latestobservations.mjs b/server/scripts/modules/latestobservations.mjs index c1a365a..1c64d2e 100644 --- a/server/scripts/modules/latestobservations.mjs +++ b/server/scripts/modules/latestobservations.mjs @@ -17,14 +17,13 @@ class LatestObservations extends WeatherDisplay { } async getData(weatherParameters, refresh) { - const superResult = super.getData(weatherParameters, refresh); + if (!super.getData(weatherParameters, refresh)) return; this.data = await parseData(this.weatherParameters); if (!this.data) { this.setStatus(STATUS.failed); - return superResult; + return; } this.setStatus(STATUS.loaded); - return superResult; } async drawCanvas() {