From 5adf9efa17d5d28f7c1e4b7e9de14bf0a1129d21 Mon Sep 17 00:00:00 2001 From: Sacha FROMENT Date: Sat, 28 Oct 2023 13:52:38 +0200 Subject: [PATCH] fix(weather forecast): updated widget Updated the widget and api route to work with the new (why ?) OpenWeater response format. --- src/components/Widgets/WeatherForecast.vue | 16 ++++++++-------- src/utils/defaults.js | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/Widgets/WeatherForecast.vue b/src/components/Widgets/WeatherForecast.vue index 3f77e4ea30..c95c045d51 100644 --- a/src/components/Widgets/WeatherForecast.vue +++ b/src/components/Widgets/WeatherForecast.vue @@ -99,7 +99,7 @@ export default { icon: day.weather[0].icon, main: day.weather[0].main, description: day.weather[0].description, - temp: this.processTemp(day.temp.day), + temp: this.processTemp(day.main.temp), info: this.makeWeatherData(day), }); }); @@ -109,15 +109,15 @@ export default { makeWeatherData(data) { return [ [ - { label: 'Min Temp', value: this.processTemp(data.temp.min) }, - { label: 'Max Temp', value: this.processTemp(data.temp.max) }, - { label: 'Feels Like', value: this.processTemp(data.feels_like.day) }, + { label: 'Min Temp', value: this.processTemp(data.main.temp_min) }, + { label: 'Max Temp', value: this.processTemp(data.main.temp_max) }, + { label: 'Feels Like', value: this.processTemp(data.main.feels_like) }, ], [ - { label: 'Pressure', value: `${data.pressure}hPa` }, - { label: 'Humidity', value: `${data.humidity}%` }, - { label: 'wind', value: `${data.speed}${this.speedDisplayUnits}` }, - { label: 'clouds', value: `${data.clouds}%` }, + { label: 'Pressure', value: `${data.main.pressure}hPa` }, + { label: 'Humidity', value: `${data.main.humidity}%` }, + { label: 'wind', value: `${data.wind.speed}${this.speedDisplayUnits}` }, + { label: 'clouds', value: `${data.clouds.all}%` }, ], ]; }, diff --git a/src/utils/defaults.js b/src/utils/defaults.js index 1e763088fa..5487e76194 100644 --- a/src/utils/defaults.js +++ b/src/utils/defaults.js @@ -247,7 +247,7 @@ module.exports = { walletBalance: 'https://api.blockcypher.com/v1', walletQrCode: 'https://www.bitcoinqrcodemaker.com/api', weather: 'https://api.openweathermap.org/data/2.5/weather', - weatherForecast: 'https://api.openweathermap.org/data/2.5/forecast/daily', + weatherForecast: 'https://api.openweathermap.org/data/2.5/forecast', xkcdComic: 'https://xkcd.vercel.app/', }, /* URLs for web search engines */