this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove weather api route since it's a server component

modamo-gh e3ddc49c 0e76b6fa

+6 -19
-15
app/api/weather/route.ts
··· 1 - import { NextRequest, NextResponse } from "next/server"; 2 - 3 - export const GET = async (request: NextRequest) => { 4 - const response = await fetch( 5 - `https://api.openweathermap.org/data/3.0/onecall?lat=39.2908816&lon=-76.610759&appid=${process.env.OPENWEATHER}&units=imperial` 6 - ); 7 - const json = await response.json(); 8 - const weather = { 9 - feelsLike: json.current.feels_like, 10 - icon: `https://openweathermap.org/img/wn/${json.current.weather[0].icon}.png`, 11 - temp: json.current.temp 12 - }; 13 - 14 - return NextResponse.json(weather); 15 - };
+6 -4
app/components/Header/components/Weather.tsx
··· 1 1 import Image from "next/image"; 2 2 3 3 const Weather = async () => { 4 - const response = await fetch("http://localhost:3000/api/weather"); 4 + const response = await fetch( 5 + `https://api.openweathermap.org/data/3.0/onecall?lat=39.2908816&lon=-76.610759&appid=${process.env.OPENWEATHER}&units=imperial` 6 + ); 5 7 const json = await response.json(); 6 8 7 9 return ( ··· 10 12 <Image 11 13 alt={""} 12 14 fill 13 - src={json.icon} 15 + src={`https://openweathermap.org/img/wn/${json.current.weather[0].icon}.png`} 14 16 /> 15 17 </div> 16 - <p>{`${Math.round(json.temp)}°`}</p> 17 - <p>{`Feels Like: ${Math.round(json.feelsLike)}°`}</p> 18 + <p>{`${Math.round(json.current.temp)}°`}</p> 19 + <p>{`Feels Like: ${Math.round(json.current.feels_like)}°`}</p> 18 20 </div> 19 21 ); 20 22 };