Skip to content

Commit

Permalink
Dont set values as null
Browse files Browse the repository at this point in the history
  • Loading branch information
BlythMeister committed Oct 15, 2024
1 parent cae4328 commit 6d2c16d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/366x366/companion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ function sendWeather(unit) {
date: new Date(),
};
//console.log(`Weather:${JSON.stringify(sendData)}`);
settingsStorage.setItem("weatherCache", JSON.stringify(weatherData));
msgq.send("weather", weatherData, true);
settingsStorage.setItem("weatherCache", JSON.stringify(weatherData));
})
.catch((e) => {
console.error(e);
Expand All @@ -209,8 +209,8 @@ function sendWeather(unit) {
location: e.message,
date: new Date(),
};
settingsStorage.setItem("weatherCache", null);
msgq.send("weather", errorWeather, true);
settingsStorage.removeItem("weatherCache");
});
} catch (e) {
console.error(e);
Expand All @@ -221,16 +221,16 @@ function sendWeather(unit) {
location: e.message,
date: new Date(),
};
settingsStorage.setItem("weatherCache", null);
msgq.send("weather", errorWeather, true);
settingsStorage.removeItem("weatherCache");
}
}

function locationChange() {
try {
let lastWeather = settingsStorage.getItem("weatherCache");
if (lastWeather) {
settingsStorage.setItem("weatherCache", null);
settingsStorage.removeItem("weatherCache");
sendWeather(lastWeather.unit);
}
} catch (e) {
Expand Down

0 comments on commit 6d2c16d

Please sign in to comment.