feat: Verwende fetch statt window.location.href für Digitalausgang-Schalteraktionen
This commit is contained in:
@@ -32,9 +32,25 @@ export default function DigitalOutputsWidget({
|
||||
|
||||
try {
|
||||
if (isCPL) {
|
||||
window.location.href = `/CPL?digitalOutputs.html&DAS0${id}=${
|
||||
updatedOutputs[id - 1].status ? 1 : 0
|
||||
}`;
|
||||
// Statt redirect:
|
||||
// window.location.href = `/CPL?...`;
|
||||
|
||||
// Verwende fetch:
|
||||
fetch(
|
||||
`/CPL?digitalOutputs.html&DAS0${id}=${
|
||||
updatedOutputs[id - 1].status ? 1 : 0
|
||||
}`,
|
||||
{
|
||||
method: "GET",
|
||||
}
|
||||
)
|
||||
.then((res) => {
|
||||
if (!res.ok) throw new Error("Fehler beim Schalten");
|
||||
// Optional: Feedback anzeigen
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error("CPL Fehler:", err);
|
||||
});
|
||||
} else {
|
||||
await fetch("/api/cpl/updateDigitalOutputsHandler", {
|
||||
method: "POST",
|
||||
|
||||
Reference in New Issue
Block a user