Files
CPLv4.0/components/main/kabelueberwachung/kue705FO/handlers/firmwareUpdate.ts

25 lines
752 B
TypeScript

// /komponents/main/kabelueberwachung/kue705FO/handlers/firmwareUpdate.ts
const firmwareUpdate = (slot: number) => {
const isDev =
typeof window !== "undefined" && window.location.hostname === "localhost";
const url = isDev
? `${window.location.origin}/api/cpl/kueSingleModuleUpdateMock?slot=${
slot + 1
}`
: `${window.location.origin}/CPL?/kabelueberwachung.html&KSU${slot}=1`;
fetch(url, { method: "GET" })
.then((response) => response.json())
.then((data) => {
alert(
data.message || `Update an Slot ${slot + 1} erfolgreich gestartet!`
);
})
.catch((error) => {
console.error("Fehler:", error);
alert("Fehler beim Update!");
});
};
export default firmwareUpdate;