local-weather/app/page.tsx
2024-05-04 09:39:10 +02:00

78 lines
1.8 KiB
TypeScript

// const lat: string = '55.645519';
// const long: string = '12.549600';
// interface Forecast {
// [coord: string]: {
// [lon: string]: number;
// [lat: string]: number;
// },
// [weather: string]: [
// {
// [id: string]: number,
// [main: string]: string,
// [description: string]: string,
// [icon: string]: string;
// }
// ],
// [base: string]: string;
// [main: string]: {
// [temp: string]: number;
// [feels_like: string]: number;
// [temp_min: string]: number;
// [temp_max: string]: number;
// [pressure: string]: number;
// [humidity: string]: number;
// [sea_level: string]: number;
// [grnd_level: string]: number;
// },
// [visibility: string]: number;
// [wind: string]: {
// [speed: string]: number;
// [deg: string]: number;
// [gust: string]: number;
// },
// [rain: string]: {
// [onehour: string]: number
// },
// [clouds: string]: {
// [all: string]: number
// },
// [dt: string]: number,
// [sys: string]: {
// [type: string]: number,
// [id: string]: number,
// [country: string]: string,
// [sunrise: string]: number,
// [sunset: string]: number;
// },
// [timezone: string]: number;
// [id: string]: number;
// [name: string]: string;
// [cod: string]: number;
// };
interface LocationType {
latitude: number;
longtitude: number;
}
function async getForecast(location: LocationType) {
const {latitude, longtitude} = location;
const forecast = fetch(`https://api.openweathermap.org/data/2.5/weather?lat=${latitude}&lon=${longtitude}&appid=${API_key}`)
return forecast
}
export default function Home() {
return (
<main>
<h1>The weather in Sluseholmen for the next 3 days</h1>
</main>
);
}