@@ -46,23 +46,28 @@ const currentDate = time.toLocaleDateString("de-DE", {
4646 hour12: false ,
4747});
4848
49+ // res = await fetch(
50+ // `https://api.openweathermap.org/data/2.5/forecast/daily?lat=${lat}&lon=${lon}&cnt=8&lang=DE&units=metric&appid=${env.OPENWEATHERMAP_API_KEY}`
51+ // );
4952res = await fetch (
50- ` https://api.openweathermap.org/data/2.5/forecast/daily ?lat=${lat }&lon=${lon }&cnt=8&lang=DE&units=metric&appid=${env .OPENWEATHERMAP_API_KEY } `
53+ ` https://api.openweathermap.org/data/3.0/onecall ?lat=${lat }&lon=${lon }&cnt=8&lang=DE&units=metric&exclude=current,minutely,hourly,alerts& appid=${env .OPENWEATHERMAPONECALL_API_KEY } `
5154);
5255const weeklyWeather = await res .json ();
56+ console .log (weeklyWeather );
5357
58+ // res = await fetch(
59+ // `https://api.openweathermap.org/data/2.5/forecast/hourly?lat=${lat}&lon=${lon}&cnt=24&lang=DE&units=metric&appid=${env.OPENWEATHERMAP_API_KEY}`
60+ // );
5461res = await fetch (
55- ` https://api.openweathermap.org/data/2.5/forecast/hourly ?lat=${lat }&lon=${lon }&cnt=24 &lang=DE&units=metric&appid=${env .OPENWEATHERMAP_API_KEY } `
62+ ` https://api.openweathermap.org/data/3.0/onecall ?lat=${lat }&lon=${lon }&cnt=8 &lang=DE&units=metric&exclude=current,minutely,daily,alerts& appid=${env .OPENWEATHERMAPONECALL_API_KEY } `
5663);
5764const hourlyWeather = await res .json ();
5865
59- const hourlyChartLabels = hourlyWeather .list .map ((h ) =>
66+ const hourlyChartLabels = hourlyWeather .hourly .map ((h ) =>
6067 formatToBerlinTime (h .dt )
6168);
62- const hourlyTemperatures = hourlyWeather .list .map ((h ) =>
63- Math .round (h .main .temp )
64- );
65- const hourlyPrecipitation = hourlyWeather .list .map ((h ) => {
69+ const hourlyTemperatures = hourlyWeather .hourly .map ((h ) => Math .round (h .temp ));
70+ const hourlyPrecipitation = hourlyWeather .hourly .map ((h ) => {
6671 if (h .rain ) {
6772 return h .rain [" 1h" ];
6873 } else {
8287 oneCall = JSON .parse (data );
8388}
8489
85-
8690const hourlyUVIndex = oneCall .hourly .slice (1 , 25 ).map ((h ) => {
8791 if (h .uvi ) {
8892 return Math .round (h .uvi );
@@ -240,7 +244,7 @@ const darkColors = [
240244 <span class =" text-4xl font-bold" >
241245 {
242246 Math .round (
243- weeklyWeather .list [0 ].temp .min
247+ weeklyWeather .daily [0 ].temp .min
244248 )
245249 } <span class =" text-2xl" >°C</span >
246250 </span >
@@ -254,7 +258,7 @@ const darkColors = [
254258 <span class =" text-4xl font-bold" >
255259 {
256260 Math .round (
257- weeklyWeather .list [0 ].temp .max
261+ weeklyWeather .daily [0 ].temp .max
258262 )
259263 } <span class =" text-2xl" >°C</span >
260264 </span >
@@ -418,7 +422,7 @@ const darkColors = [
418422 },
419423 ]} >
420424 {
421- weeklyWeather .list
425+ weeklyWeather .daily
422426 .slice (1 )
423427 .map ((item ) => (
424428 <SingleWeatherCard
0 commit comments