fix: update fetchDigitalOutputsService.ts to use /api/cpl/digitalOutputsAPIHandler in development
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
"use client";
|
"use client"; // /components/main/einausgaenge/DigitalOutputs.tsx
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Icon } from "@iconify/react";
|
import { Icon } from "@iconify/react";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
"use client";
|
"use client"; // /compoenents/main/einausgaenge/modals/OutputModal.tsx
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
export default function OutputModal({
|
export default function OutputModal({
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ export default function TdrEinstellung({ slot }: Props) {
|
|||||||
<div className="pt-4 flex justify-end">
|
<div className="pt-4 flex justify-end">
|
||||||
<button
|
<button
|
||||||
onClick={handleSave}
|
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
|
💾 Einstellungen senden
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -6,5 +6,5 @@
|
|||||||
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
|
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
const webVersion = "1.6.281";
|
const webVersion = "1.6.282";
|
||||||
export default webVersion;
|
export default webVersion;
|
||||||
|
|||||||
@@ -1,33 +1,26 @@
|
|||||||
"use client";
|
"use client"; // /pages/digitalOutputs.tsx
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { AppDispatch, RootState } from "../redux/store";
|
import { AppDispatch, RootState } from "../redux/store";
|
||||||
|
|
||||||
import InputModal from "../components/main/einausgaenge/modals/InputModal";
|
|
||||||
import OutputModal from "../components/main/einausgaenge/modals/OutputModal";
|
import OutputModal from "../components/main/einausgaenge/modals/OutputModal";
|
||||||
|
|
||||||
import { fetchDigitaleEingaengeThunk } from "../redux/thunks/fetchDigitaleEingaengeThunk";
|
import { fetchDigitaleEingaengeThunk } from "../redux/thunks/fetchDigitaleEingaengeThunk";
|
||||||
import { fetchDigitalOutputsThunk } from "../redux/thunks/fetchDigitalOutputsThunk";
|
import { fetchDigitalOutputsThunk } from "../redux/thunks/fetchDigitalOutputsThunk";
|
||||||
|
|
||||||
import DigitalOutputs from "../components/main/einausgaenge/DigitalOutputs";
|
import DigitalOutputs from "../components/main/einausgaenge/DigitalOutputs";
|
||||||
import DigitalInputs from "../components/main/einausgaenge/DigitalInputs";
|
|
||||||
|
|
||||||
const EinAusgaenge: React.FC = () => {
|
const EinAusgaenge: React.FC = () => {
|
||||||
const dispatch = useDispatch<AppDispatch>();
|
const dispatch = useDispatch<AppDispatch>();
|
||||||
const digitalInputs = useSelector(
|
|
||||||
(state: RootState) => state.digitalInputsSlice.inputs
|
|
||||||
);
|
|
||||||
const digitalOutputs = useSelector(
|
const digitalOutputs = useSelector(
|
||||||
(state: RootState) => state.digitalOutputsSlice.outputs
|
(state: RootState) => state.digitalOutputsSlice.outputs
|
||||||
);
|
);
|
||||||
|
|
||||||
const [selectedInput, setSelectedInput] = useState(null);
|
|
||||||
const [selectedOutput, setSelectedOutput] = useState(null);
|
const [selectedOutput, setSelectedOutput] = useState(null);
|
||||||
const [isInputModalOpen, setIsInputModalOpen] = useState(false);
|
|
||||||
const [isOutputModalOpen, setIsOutputModalOpen] = useState(false);
|
const [isOutputModalOpen, setIsOutputModalOpen] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(fetchDigitaleEingaengeThunk());
|
|
||||||
dispatch(fetchDigitalOutputsThunk());
|
dispatch(fetchDigitalOutputsThunk());
|
||||||
|
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
@@ -38,16 +31,6 @@ const EinAusgaenge: React.FC = () => {
|
|||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
|
|
||||||
const openInputModal = (input: any) => {
|
|
||||||
setSelectedInput(input);
|
|
||||||
setIsInputModalOpen(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
const closeInputModal = () => {
|
|
||||||
setSelectedInput(null);
|
|
||||||
setIsInputModalOpen(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const openOutputModal = (output: any) => {
|
const openOutputModal = (output: any) => {
|
||||||
setSelectedOutput(output);
|
setSelectedOutput(output);
|
||||||
setIsOutputModalOpen(true);
|
setIsOutputModalOpen(true);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// ✅ Service: /services/fetchDigitalOutputsService.ts
|
// /services/fetchDigitalOutputsService.ts
|
||||||
|
|
||||||
export const fetchDigitalOutputsService = async () => {
|
export const fetchDigitalOutputsService = async () => {
|
||||||
if (typeof window === "undefined") return [];
|
if (typeof window === "undefined") return [];
|
||||||
@@ -6,7 +6,7 @@ export const fetchDigitalOutputsService = async () => {
|
|||||||
const scriptSrc =
|
const scriptSrc =
|
||||||
process.env.NEXT_PUBLIC_NODE_ENV === "production"
|
process.env.NEXT_PUBLIC_NODE_ENV === "production"
|
||||||
? "/CPL?/CPL/SERVICE/da.js"
|
? "/CPL?/CPL/SERVICE/da.js"
|
||||||
: "/api/cpl/digitaleAusgaengeAPIHandler";
|
: "/api/cpl/digitalOutputsAPIHandler";
|
||||||
|
|
||||||
await new Promise<void>((resolve, reject) => {
|
await new Promise<void>((resolve, reject) => {
|
||||||
const script = document.createElement("script");
|
const script = document.createElement("script");
|
||||||
|
|||||||
Reference in New Issue
Block a user