fix: API Endpoint in fetchOpcUaSettingsService für Development korrigiert
- falsches .js im API Pfad entfernt - Development lädt jetzt korrekt /api/cpl/opcuaAPIHandler - Production bleibt unverändert
This commit is contained in:
@@ -6,5 +6,5 @@
|
||||
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
|
||||
|
||||
*/
|
||||
const webVersion = "1.6.223";
|
||||
const webVersion = "1.6.224";
|
||||
export default webVersion;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// /pages/api/cpl/opcuaSettingsAPIHandler.ts
|
||||
// /pages/api/cpl/opcuaAPIHandler.ts
|
||||
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import path from "path";
|
||||
@@ -21,8 +21,7 @@ export default async function handler(
|
||||
|
||||
const jsonFilePath = path.join(
|
||||
process.cwd(),
|
||||
"public",
|
||||
"CPLmockData",
|
||||
"apiMockData",
|
||||
"kuesChartData",
|
||||
`slot${slot}`,
|
||||
`${messart}`,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// ✅ Thunk: /redux/thunks/fetchKueDataThunk.ts
|
||||
|
||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||
import { fetchKueData } from "../../services/fetchKueData";
|
||||
import { fetchKueDataService } from "../../services/fetchKueDataService";
|
||||
import { setKueData } from "../slices/kueDataSlice";
|
||||
|
||||
export const fetchKueDataThunk = createAsyncThunk(
|
||||
"kueData/fetch",
|
||||
async (_, { dispatch }) => {
|
||||
const data = await fetchKueData();
|
||||
const data = await fetchKueDataService();
|
||||
if (data) {
|
||||
dispatch(setKueData(data));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// /redux/thunks/fetchLast20MessagesThunk.ts
|
||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||
import { fetchLast20MessagesFromWindow } from "../../services/fetchLast20Messages";
|
||||
import { fetchLast20MessagesFromWindow } from "../../services/fetchLast20MessagesService";
|
||||
import { setLast20Messages } from "../slices/last20MessagesSlice";
|
||||
|
||||
export const fetchLast20MessagesThunk = createAsyncThunk(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ✅ 2. Thunk: /redux/thunks/fetchOpcUaSettingsThunk.ts
|
||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||
import { fetchOpcUaSettings } from "../../services/fetchOpcUaSettings";
|
||||
import { fetchOpcUaSettingsService } from "../../services/fetchOpcUaSettingsService";
|
||||
import {
|
||||
setOpcUaZustand,
|
||||
setOpcUaEncryption,
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
export const fetchOpcUaSettingsThunk = createAsyncThunk(
|
||||
"opcuaSettings/fetch",
|
||||
async (_, { dispatch }) => {
|
||||
const data = await fetchOpcUaSettings();
|
||||
const data = await fetchOpcUaSettingsService();
|
||||
if (!data) return;
|
||||
|
||||
dispatch(setOpcUaZustand(data.zustand));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// /redux/thunks/fetchSystemSettingsThunk.ts
|
||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||
import { fetchSystemSettings } from "../../services/fetchSystemSettings";
|
||||
import { fetchSystemSettings } from "../../services/fetchSystemSettingsService";
|
||||
import { setSystemSettings } from "../slices/systemSettingsSlice";
|
||||
|
||||
export const fetchSystemSettingsThunk = createAsyncThunk(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// services/fetchAnalogeEingaengeService.ts
|
||||
|
||||
export const fetchAnalogeEingaenge = async (): Promise<Record<
|
||||
export const fetchAnalogeEingaengeService = async (): Promise<Record<
|
||||
string,
|
||||
any
|
||||
> | null> => {
|
||||
@@ -12,7 +12,7 @@ export const fetchAnalogeEingaenge = async (): Promise<Record<
|
||||
|
||||
// Skriptpfad abhängig von der Umgebung
|
||||
const scriptSrc = isDevelopment
|
||||
? "/apiMockData/SERVICE/ae.js"
|
||||
? "/api/cpl/analogeEingaengeAPIHandler"
|
||||
: "/CPL?/CPL/SERVICE/ae.js";
|
||||
|
||||
// Skript dynamisch laden
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// ✅ Service: /services/fetchDigitalOutputsService.ts
|
||||
|
||||
export const fetchDigitalOutputs = async () => {
|
||||
export const fetchDigitalOutputsService = async () => {
|
||||
if (typeof window === "undefined") return [];
|
||||
|
||||
const scriptSrc =
|
||||
process.env.NEXT_PUBLIC_NODE_ENV === "production"
|
||||
? "/CPL?/CPL/SERVICE/da.js"
|
||||
: "/apiMockData/SERVICE/da.js";
|
||||
: "/api/cpl/digitaleAusgaengeAPIHandler";
|
||||
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const script = document.createElement("script");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ✅ Service: /services/fetchDigitaleEingaengeService.ts
|
||||
|
||||
export const fetchDigitaleEingaenge = async () => {
|
||||
export const fetchDigitaleEingaengeService = async () => {
|
||||
try {
|
||||
if (typeof window === "undefined") return null;
|
||||
|
||||
@@ -8,7 +8,7 @@ export const fetchDigitaleEingaenge = async () => {
|
||||
const scriptSrc =
|
||||
process.env.NEXT_PUBLIC_NODE_ENV === "production"
|
||||
? "/CPL?/CPL/SERVICE/de.js"
|
||||
: "/apiMockData/SERVICE/de.js";
|
||||
: "/api/cpl/digitaleEingaengeAPIHandler";
|
||||
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const script = document.createElement("script");
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// ✅ Service: /services/fetchKueDataService.ts
|
||||
|
||||
const devScriptPath = "/CPLmockData/SERVICE/kueData.js";
|
||||
const devScriptPath = "/api/cpl/kabelueberwachungAPIHandler";
|
||||
const prodScriptPath = "/CPL?/CPL/SERVICE/kueData.js";
|
||||
|
||||
export const fetchKueData = async () => {
|
||||
export const fetchKueDataService = async () => {
|
||||
try {
|
||||
if (typeof window === "undefined") return null;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ export const fetchLast20MessagesFromWindow = async (): Promise<
|
||||
const isDev = process.env.NEXT_PUBLIC_NODE_ENV === "development";
|
||||
|
||||
const scriptSrc = isDev
|
||||
? "/api/cpl/last20Messages" // in Dev → per API geladen
|
||||
? "/api/cpl/last20MessagesAPIHandler" // in Dev → per API geladen
|
||||
: "/CPL?/CPL/SERVICE/Start.js"; // in Prod → echtes Script vom CPL
|
||||
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
|
||||
@@ -24,7 +24,7 @@ const getApiUrl = (
|
||||
|
||||
return process.env.NEXT_PUBLIC_NODE_ENV === "development"
|
||||
? // ? `/CPLmockData/kuesChartData/slot${slotNumber}/${typeFolder}/${mode}.json`
|
||||
`/api/cpl/slotData?slot=${slotNumber}&messart=${typeFolder}&dia=${mode}&vonDatum=${vonDatum}&bisDatum=${bisDatum}`
|
||||
`/api/cpl/slotDataAPIHandler?slot=${slotNumber}&messart=${typeFolder}&dia=${mode}&vonDatum=${vonDatum}&bisDatum=${bisDatum}`
|
||||
: `${window.location.origin}/CPL?seite.ACP&${mode}=${formatDate(
|
||||
vonDatum
|
||||
)};${formatDate(bisDatum)};${slotNumber};${type};`;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ✅ 1. Service: /services/fetchOpcUaSettingsService.ts
|
||||
|
||||
export const fetchOpcUaSettings = async () => {
|
||||
export const fetchOpcUaSettingsService = async () => {
|
||||
try {
|
||||
if (typeof window === "undefined") return null;
|
||||
|
||||
@@ -8,7 +8,7 @@ export const fetchOpcUaSettings = async () => {
|
||||
const scriptSrc =
|
||||
process.env.NEXT_PUBLIC_NODE_ENV === "production"
|
||||
? "/CPL?/CPL/SERVICE/opcua.js"
|
||||
: "/apiMockData/SERVICE/opcua.js";
|
||||
: "/api/cpl/opcuaAPIHandler";
|
||||
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const script = document.createElement("script");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// /services/fetchSingleTDMDataService.ts
|
||||
|
||||
export const fetchTDMDataBySlot = async (slot: number): Promise<any> => {
|
||||
export const fetchSingleTDMDataService = async (slot: number): Promise<any> => {
|
||||
if (typeof window === "undefined") return null;
|
||||
|
||||
const isDev = process.env.NEXT_PUBLIC_NODE_ENV === "development";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// /services/fetchSystemSettingsService.ts
|
||||
export const fetchSystemSettings = async () => {
|
||||
export const fetchSystemSettingsService = async () => {
|
||||
try {
|
||||
if (typeof window === "undefined") return null;
|
||||
|
||||
const isDev = process.env.NODE_ENV === "development";
|
||||
const scriptSrc =
|
||||
process.env.NEXT_PUBLIC_NODE_ENV === "development"
|
||||
? "/apiMockData/SERVICE/system.js"
|
||||
? "/api/cpl/systemAPIHandler"
|
||||
: "/CPL?/CPL/SERVICE/system.js";
|
||||
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// /services/fetchTDRChartDataByIdService.ts
|
||||
|
||||
export const fetchTDRChartDataById = async (
|
||||
export const fetchTDRChartDataByIdService = async (
|
||||
id: number
|
||||
): Promise<any[] | null> => {
|
||||
const isDev = process.env.NEXT_PUBLIC_NODE_ENV === "development";
|
||||
|
||||
const url = isDev
|
||||
? `http://localhost:3000/apiMockData/TDR/${id}.json`
|
||||
? `/api/cpl/TDR/${id}.json`
|
||||
: `${window.location.origin}/CPL?Service/empty.acp&TDR=${id}`;
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// /services/fetchTDRReferenceCurveService.ts
|
||||
|
||||
export const fetchTDRReferenceCurve = async (
|
||||
export const fetchTDRReferenceCurveService = async (
|
||||
slot: number
|
||||
): Promise<any[] | null> => {
|
||||
// ✅ Erst aus localStorage lesen
|
||||
|
||||
Reference in New Issue
Block a user