Files
nodeMap/services/api/fetchDeviceNameById.js
2025-03-05 09:48:02 +01:00

15 lines
462 B
JavaScript

export const fetchDeviceNameById = async (idLD) => {
try {
const response = await fetch(`/api/talas_v5_DB/locationDevice/locationDeviceNameById?idLD=${idLD}`);
const data = await response.json();
if (response.ok) {
return data.name;
} else {
throw new Error("Gerät nicht gefunden");
}
} catch (error) {
console.error("Fehler beim Abrufen des Gerätenamens in fetchDeviceNameById:", error);
return "Unbekannt";
}
};