35 lines
772 B
TypeScript
35 lines
772 B
TypeScript
import { fetchWeatherApi } from "openmeteo";
|
|
|
|
const params = {
|
|
latitude: 49.0094,
|
|
longitude: 8.4044,
|
|
daily: ["temperature_2m_max", "temperature_2m_min"],
|
|
hourly: [
|
|
"temperature_2m",
|
|
"precipitation",
|
|
"rain",
|
|
"precipitation_probability",
|
|
],
|
|
current: [
|
|
"temperature_2m",
|
|
"precipitation",
|
|
"rain",
|
|
"showers",
|
|
"snowfall",
|
|
"relative_humidity_2m",
|
|
"apparent_temperature",
|
|
"weather_code",
|
|
"cloud_cover",
|
|
"is_day",
|
|
],
|
|
timezone: "Europe/Berlin",
|
|
timeformat: "unixtime",
|
|
};
|
|
const url = "https://api.open-meteo.com/v1/forecast";
|
|
|
|
function fetchWeatherData() {
|
|
return fetchWeatherApi(url, params);
|
|
}
|
|
|
|
export default fetchWeatherData;
|