esLint
This commit is contained in:
@@ -3,13 +3,12 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import { RootState } from "@/redux/store";
|
||||
import switchIcon from "@iconify/icons-ion/switch";
|
||||
import { updateInvert, updateLabel } from "@/redux/slices/digitalInputsSlice";
|
||||
|
||||
type InputModalProps = {
|
||||
selectedInput: {
|
||||
id: number;
|
||||
[key: string]: any;
|
||||
[key: string]: unknown;
|
||||
} | null;
|
||||
closeInputModal: () => void;
|
||||
isOpen: boolean;
|
||||
@@ -51,8 +50,24 @@ export default function InputModal({
|
||||
}
|
||||
}, [reduxInput, isInitialLoad]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpen && selectedInput) {
|
||||
setIsInitialLoad(true);
|
||||
}
|
||||
}, [isOpen, selectedInput]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpen && selectedInput) {
|
||||
setIsInitialLoad(true);
|
||||
}
|
||||
}, [isOpen, selectedInput]);
|
||||
|
||||
if (!isOpen || !selectedInput || !reduxInput) return null;
|
||||
|
||||
const handleClose = () => {
|
||||
closeInputModal();
|
||||
};
|
||||
|
||||
const sendCgiUpdate = async (param: string) => {
|
||||
const url = `/CPL?/eingaenge.html&${param}`;
|
||||
//console.log("📡 CGI senden:", url);
|
||||
@@ -103,7 +118,15 @@ export default function InputModal({
|
||||
alert("✅ Daten erfolgreich an die CPL-Hardware gesendet!");
|
||||
} else {
|
||||
// ENTWICKLUNGSUMGEBUNG (lokale API)
|
||||
const updates: any = { id };
|
||||
type Updates = {
|
||||
id: number;
|
||||
label?: string;
|
||||
invert?: number;
|
||||
timeFilter?: number;
|
||||
weighting?: number;
|
||||
zaehlerAktiv?: number;
|
||||
};
|
||||
const updates: Updates = { id };
|
||||
if (label !== reduxInput.label) {
|
||||
updates.label = label;
|
||||
dispatch(updateLabel({ id, label }));
|
||||
@@ -148,21 +171,15 @@ export default function InputModal({
|
||||
|
||||
setIsInitialLoad(true);
|
||||
closeInputModal();
|
||||
} catch (err: any) {
|
||||
alert("❌ Fehler beim Speichern: " + err.message);
|
||||
} catch (err: unknown) {
|
||||
if (err instanceof Error) {
|
||||
alert("❌ Fehler beim Speichern: " + err.message);
|
||||
} else {
|
||||
alert("❌ Fehler beim Speichern: Unbekannter Fehler");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
setIsInitialLoad(true);
|
||||
closeInputModal();
|
||||
};
|
||||
useEffect(() => {
|
||||
if (isOpen && selectedInput) {
|
||||
setIsInitialLoad(true);
|
||||
}
|
||||
}, [isOpen, selectedInput]);
|
||||
|
||||
return (
|
||||
<div className="fixed top-0 left-0 w-full h-full bg-black bg-opacity-50 flex justify-center items-center z-50">
|
||||
<div className="bg-white rounded-lg shadow-lg p-6 w-1/2 max-w-lg">
|
||||
|
||||
Reference in New Issue
Block a user