add weather module
This commit is contained in:
34
src/api/weather.ts
Normal file
34
src/api/weather.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user