export const goTDR = ( slotIndex: number, setLoading: (loading: boolean) => void ) => { if (slotIndex >= 32) { return; } const slotFormat = slotIndex < 10 ? `${slotIndex}` : `${slotIndex}`; setLoading(true); alert(`TDR wird für Slot ${slotIndex + 1} gestartet...`); fetch( `/CPL?Service/Kabelueberwachung.html&KTT${slotFormat}=1&slot=${slotIndex}`, { method: "GET", } ) .then((response) => { if (response.ok) { alert(`TDR erfolgreich gestartet für Slot ${slotIndex + 1}`); console.log("TDR erfolgreich gestartet für Slot", slotIndex + 1); } else { console.error("Fehler beim Senden der TDR-Anfrage"); } }) .catch((error) => { console.error("Fehler:", error); }) .finally(() => setLoading(false)); };