fix: update fetchDigitalOutputsService.ts to use /api/cpl/digitalOutputsAPIHandler in development

This commit is contained in:
Ismail Ali
2025-04-26 19:48:57 +02:00
parent eae2cbd682
commit fc66346663
6 changed files with 8 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
"use client";
"use client"; // /components/main/einausgaenge/DigitalOutputs.tsx
import React from "react";
import { Icon } from "@iconify/react";
import { useSelector } from "react-redux";

View File

@@ -1,4 +1,4 @@
"use client";
"use client"; // /compoenents/main/einausgaenge/modals/OutputModal.tsx
import React from "react";
export default function OutputModal({

View File

@@ -117,7 +117,7 @@ export default function TdrEinstellung({ slot }: Props) {
<div className="pt-4 flex justify-end">
<button
onClick={handleSave}
className="bg-blue-600 text-white px-4 py-2 rounded shadow hover:bg-blue-700"
className="bg-littwin-blue text-white px-4 py-2 rounded shadow hover:bg-blue-700"
>
💾 Einstellungen senden
</button>

View File

@@ -6,5 +6,5 @@
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
*/
const webVersion = "1.6.281";
const webVersion = "1.6.282";
export default webVersion;

View File

@@ -1,33 +1,26 @@
"use client";
"use client"; // /pages/digitalOutputs.tsx
import React, { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { AppDispatch, RootState } from "../redux/store";
import InputModal from "../components/main/einausgaenge/modals/InputModal";
import OutputModal from "../components/main/einausgaenge/modals/OutputModal";
import { fetchDigitaleEingaengeThunk } from "../redux/thunks/fetchDigitaleEingaengeThunk";
import { fetchDigitalOutputsThunk } from "../redux/thunks/fetchDigitalOutputsThunk";
import DigitalOutputs from "../components/main/einausgaenge/DigitalOutputs";
import DigitalInputs from "../components/main/einausgaenge/DigitalInputs";
const EinAusgaenge: React.FC = () => {
const dispatch = useDispatch<AppDispatch>();
const digitalInputs = useSelector(
(state: RootState) => state.digitalInputsSlice.inputs
);
const digitalOutputs = useSelector(
(state: RootState) => state.digitalOutputsSlice.outputs
);
const [selectedInput, setSelectedInput] = useState(null);
const [selectedOutput, setSelectedOutput] = useState(null);
const [isInputModalOpen, setIsInputModalOpen] = useState(false);
const [isOutputModalOpen, setIsOutputModalOpen] = useState(false);
useEffect(() => {
dispatch(fetchDigitaleEingaengeThunk());
dispatch(fetchDigitalOutputsThunk());
const interval = setInterval(() => {
@@ -38,16 +31,6 @@ const EinAusgaenge: React.FC = () => {
return () => clearInterval(interval);
}, [dispatch]);
const openInputModal = (input: any) => {
setSelectedInput(input);
setIsInputModalOpen(true);
};
const closeInputModal = () => {
setSelectedInput(null);
setIsInputModalOpen(false);
};
const openOutputModal = (output: any) => {
setSelectedOutput(output);
setIsOutputModalOpen(true);

View File

@@ -1,4 +1,4 @@
// ✅ Service: /services/fetchDigitalOutputsService.ts
// /services/fetchDigitalOutputsService.ts
export const fetchDigitalOutputsService = async () => {
if (typeof window === "undefined") return [];
@@ -6,7 +6,7 @@ export const fetchDigitalOutputsService = async () => {
const scriptSrc =
process.env.NEXT_PUBLIC_NODE_ENV === "production"
? "/CPL?/CPL/SERVICE/da.js"
: "/api/cpl/digitaleAusgaengeAPIHandler";
: "/api/cpl/digitalOutputsAPIHandler";
await new Promise<void>((resolve, reject) => {
const script = document.createElement("script");