Main/resources/[Developer]/[Mark]/av_weather/ui/src/hooks/getLang.ts
2025-06-07 08:51:21 +02:00

16 lines
444 B
TypeScript

const apiUrl = "lang.json";
export const getLang = async () => {
try {
const response = await fetch(apiUrl);
if (!response.ok) {
throw new Error(`Error fetching data: ${response.statusText}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error("An error occurred while fetching data:", error);
// Handle error or dispatch an error action if needed.
}
};