added null check for weather key (#71)

* added null check for weather key

* Update index.ts

removed an unneeded import

* Update index.ts

removed more junk.

I need to be better about cleaning up my code before commiting it 😅

* Update index.ts

okay last one

* removed visibility change, adjusted null check to still display default values

* Formatting

---------

Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com>
This commit is contained in:
matavach
2024-08-04 14:19:40 -05:00
committed by GitHub
parent 624b3e2ad0
commit b6d573ac2b

View File

@@ -19,6 +19,9 @@ const WeatherWidget = () => {
Utils.merge( Utils.merge(
[key.bind("value"), interval.bind("value"), location.bind("value")], [key.bind("value"), interval.bind("value"), location.bind("value")],
(weatherKey, weatherInterval, loc) => { (weatherKey, weatherInterval, loc) => {
if (!weatherKey) {
return theWeather.value = DEFAULT_WEATHER;
}
Utils.interval(weatherInterval, () => { Utils.interval(weatherInterval, () => {
const formattedLocation = loc.replace(" ", "%20"); const formattedLocation = loc.replace(" ", "%20");
Utils.execAsync( Utils.execAsync(
@@ -49,7 +52,7 @@ const WeatherWidget = () => {
}); });
}, },
); );
return (self.child = Widget.Box({ return (self.child = Widget.Box({
vertical: true, vertical: true,
hexpand: true, hexpand: true,