Merge branch 'development' into debian12fullstack

This commit is contained in:
2025-08-03 17:27:10 +02:00
8 changed files with 35 additions and 128 deletions

View File

@@ -1,4 +1,5 @@
import { myToast } from "./toastify";
import Cookies from "js-cookie";
export const fetchWeather = async (
city: string,
@@ -10,10 +11,14 @@ export const fetchWeather = async (
`https://api.openweathermap.org/geo/1.0/direct?q=${city}&appid=${apiKey}`
).then((response) => {
if (response.status === 401) {
myToast(
"You are not authorized to access this resource. Please check your API key. (Error: x4010)",
"error"
);
if (Cookies.get("apiKey") === undefined || Cookies.get("apiKey") === "") {
myToast("You have to enter an API key!", "error");
} else {
myToast(
"You are not authorized to access this resource. Please check your API key. (Error: x4010)",
"error"
);
}
} else if (response.ok) {
return response.json();
} else {