refactor: modularize handleSave, handleChange, and handleDisplayEinschalten in KueModal

This commit is contained in:
ISA
2024-11-12 08:14:13 +01:00
parent 8e56e502c9
commit ea13652135
5 changed files with 139 additions and 103 deletions

View File

@@ -0,0 +1,18 @@
// components/modals/kueModal/handlers/handleDisplayEinschalten.js
const handleDisplayEinschalten = (slot) => {
const url = `/CPL?/kabelueberwachung.html&KSD${slot}=1`;
fetch(url, { method: "GET" })
.then((response) => {
if (response.ok) {
alert(`Display für Slot ${slot + 1} erfolgreich eingeschaltet!`);
} else {
alert("Fehler beim Einschalten des Displays!");
}
})
.catch((error) => {
console.error("Fehler:", error);
alert("Fehler beim Einschalten des Displays!");
});
};
export default handleDisplayEinschalten;