Schleifen und TDR Messung starten ohne apiURL

This commit is contained in:
ISA
2024-10-22 11:59:12 +02:00
parent f5293947f1
commit 009a54bd6a

View File

@@ -116,7 +116,7 @@ function Kue705FO({
// Funktion für die TDR-Messung // Funktion für die TDR-Messung
const goTDR = () => { const goTDR = () => {
//------------------------------------------------- //-------------------------------------------------
const [isClient, setIsClient] = useState(false); /* const [isClient, setIsClient] = useState(false);
useEffect(() => { useEffect(() => {
// This will only run in the client/browser, not on the server // This will only run in the client/browser, not on the server
@@ -125,7 +125,7 @@ function Kue705FO({
if (!isClient) { if (!isClient) {
return null; // or a loading spinner return null; // or a loading spinner
} } */
//------------------------------------------------- //-------------------------------------------------
let slot = slotIndex; let slot = slotIndex;
@@ -135,16 +135,10 @@ function Kue705FO({
let slotFormat = slot < 10 ? `0${slot}` : `${slot}`; let slotFormat = slot < 10 ? `0${slot}` : `${slot}`;
//const apiUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
const apiUrl = `https://${window.ip}:443`;
setLoading(true); setLoading(true);
fetch( fetch(`/CPL?Service/KUEdetailTDR.ACP&KTT${slotFormat}=1&slot=${slot}`, {
`${apiUrl}/CPL?Service/KUEdetailTDR.ACP&KTT${slotFormat}=1&slot=${slot}`, method: "GET",
{ })
method: "GET",
}
)
.then((response) => { .then((response) => {
if (response.ok) { if (response.ok) {
console.log("TDR erfolgreich gestartet für Slot", slot); console.log("TDR erfolgreich gestartet für Slot", slot);
@@ -167,17 +161,13 @@ function Kue705FO({
} }
let slotFormat = slot < 10 ? `0${slot}` : `${slot}`; let slotFormat = slot < 10 ? `0${slot}` : `${slot}`;
const apiUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
setLoading(true); // Setze den Ladezustand auf true setLoading(true); // Setze den Ladezustand auf true
alert(`Schleifenmessung wird für Slot ${slot} gestartet...`); alert(`Schleifenmessung wird für Slot ${slot} gestartet...`);
fetch( fetch(`/CPL?Service/KUEdetail.HTML&KS_${slotFormat}=1&slot=${slot}`, {
`${apiUrl}/CPL?Service/KUEdetail.HTML&KS_${slotFormat}=1&slot=${slot}`, method: "GET",
{ })
method: "GET",
}
)
.then((response) => { .then((response) => {
if (response.ok) { if (response.ok) {
alert(`Schleifenmessung erfolgreich gestartet für Slot ${slot}`); alert(`Schleifenmessung erfolgreich gestartet für Slot ${slot}`);