From 8bdff8771231008402b73a657e93ce5a21e5513b Mon Sep 17 00:00:00 2001 From: ISA Date: Wed, 16 Oct 2024 08:59:12 +0200 Subject: [PATCH] TDR Messung starten --- components/modules/Kue705FO.jsx | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/components/modules/Kue705FO.jsx b/components/modules/Kue705FO.jsx index f848767..3ccbbf2 100644 --- a/components/modules/Kue705FO.jsx +++ b/components/modules/Kue705FO.jsx @@ -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