TDR Messung starten

This commit is contained in:
ISA
2024-10-16 08:59:12 +02:00
parent 2171a01e0d
commit 8bdff87712

View File

@@ -31,10 +31,35 @@ function Kue705FO({
return;
}
// Bereite die URL mit den Slot-Informationen vor und leite weiter
// Bereite die Slot-Informationen vor
let slotFormat = slot < 10 ? `0${slot}` : `${slot}`;
window.location.href = `../CPL?kabelueberwachung.ACP&KTT${slotFormat}=1&slot=${slot}`;
console.log("TDR clicked for Slot", slot);
const data = {
[`KTT${slotFormat}`]: 1,
slot: slot,
};
// Die Basis-URL von der Umgebungsvariable holen
const apiUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
// Sende die POST-Anfrage an den Server mit der Basis-URL
fetch(`${apiUrl}/CPL?Service/KUEdetailTDR.ACP`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data), // Konvertiere die Daten in JSON-Format
})
.then((response) => {
if (response.ok) {
console.log("POST erfolgreich gesendet für Slot", slot);
// Hier kannst du zusätzliche Logik hinzufügen, z. B. eine Erfolgsnachricht anzeigen
} else {
console.error("Fehler beim Senden der POST-Anfrage");
}
})
.catch((error) => {
console.error("Fehler:", error);
});
};
// Überprüfe, ob ein Modul im Slot vorhanden ist