Skip to content

Commit 5adf9ef

Browse files
committed
fix(weather forecast): updated widget
Updated the widget and api route to work with the new (why ?) OpenWeater response format.
1 parent 974c116 commit 5adf9ef

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/components/Widgets/WeatherForecast.vue

+8-8
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export default {
9999
icon: day.weather[0].icon,
100100
main: day.weather[0].main,
101101
description: day.weather[0].description,
102-
temp: this.processTemp(day.temp.day),
102+
temp: this.processTemp(day.main.temp),
103103
info: this.makeWeatherData(day),
104104
});
105105
});
@@ -109,15 +109,15 @@ export default {
109109
makeWeatherData(data) {
110110
return [
111111
[
112-
{ label: 'Min Temp', value: this.processTemp(data.temp.min) },
113-
{ label: 'Max Temp', value: this.processTemp(data.temp.max) },
114-
{ label: 'Feels Like', value: this.processTemp(data.feels_like.day) },
112+
{ label: 'Min Temp', value: this.processTemp(data.main.temp_min) },
113+
{ label: 'Max Temp', value: this.processTemp(data.main.temp_max) },
114+
{ label: 'Feels Like', value: this.processTemp(data.main.feels_like) },
115115
],
116116
[
117-
{ label: 'Pressure', value: `${data.pressure}hPa` },
118-
{ label: 'Humidity', value: `${data.humidity}%` },
119-
{ label: 'wind', value: `${data.speed}${this.speedDisplayUnits}` },
120-
{ label: 'clouds', value: `${data.clouds}%` },
117+
{ label: 'Pressure', value: `${data.main.pressure}hPa` },
118+
{ label: 'Humidity', value: `${data.main.humidity}%` },
119+
{ label: 'wind', value: `${data.wind.speed}${this.speedDisplayUnits}` },
120+
{ label: 'clouds', value: `${data.clouds.all}%` },
121121
],
122122
];
123123
},

src/utils/defaults.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ module.exports = {
247247
walletBalance: 'https://api.blockcypher.com/v1',
248248
walletQrCode: 'https://www.bitcoinqrcodemaker.com/api',
249249
weather: 'https://api.openweathermap.org/data/2.5/weather',
250-
weatherForecast: 'https://api.openweathermap.org/data/2.5/forecast/daily',
250+
weatherForecast: 'https://api.openweathermap.org/data/2.5/forecast',
251251
xkcdComic: 'https://xkcd.vercel.app/',
252252
},
253253
/* URLs for web search engines */

0 commit comments

Comments
 (0)