17 lines
444 B
TypeScript
17 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.
|
||
|
}
|
||
|
};
|