diff --git a/.env.development b/.env.development index 49cb895..0b2aaf0 100644 --- a/.env.development +++ b/.env.development @@ -6,6 +6,6 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false NEXT_PUBLIC_EXPORT_STATIC=false NEXT_PUBLIC_USE_CGI=false # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.6.534 +NEXT_PUBLIC_APP_VERSION=1.6.535 NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter) diff --git a/.env.production b/.env.production index 55405e0..93713ec 100644 --- a/.env.production +++ b/.env.production @@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL NEXT_PUBLIC_EXPORT_STATIC=true NEXT_PUBLIC_USE_CGI=true # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.6.534 +NEXT_PUBLIC_APP_VERSION=1.6.535 NEXT_PUBLIC_CPL_MODE=production \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bac68a..d371e99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [1.6.535] – 2025-07-03 + +- feat: in System 5 Volt DIA0, DIA1 und DIA2 in dropdown anzeigen + +--- ## [1.6.534] – 2025-07-03 - feat: in System 5 Volt DIA0, DIA1 und DIA2 in dropdown anzeigen diff --git a/package-lock.json b/package-lock.json index 552074a..016c41b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cpl-v4", - "version": "1.6.534", + "version": "1.6.535", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cpl-v4", - "version": "1.6.534", + "version": "1.6.535", "dependencies": { "@fontsource/roboto": "^5.1.0", "@iconify-icons/ri": "^1.2.10", diff --git a/package.json b/package.json index d856c60..e2fd578 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cpl-v4", - "version": "1.6.534", + "version": "1.6.535", "private": true, "scripts": { "dev": "next dev", diff --git a/pages/api/cpl/getSystemspannung15VminusHandler.ts b/pages/api/cpl/getSystemspannung15VminusHandler.ts new file mode 100644 index 0000000..463f1dd --- /dev/null +++ b/pages/api/cpl/getSystemspannung15VminusHandler.ts @@ -0,0 +1,33 @@ +import { NextApiRequest, NextApiResponse } from "next"; +import path from "path"; +import fs from "fs/promises"; + +export default async function handler( + req: NextApiRequest, + res: NextApiResponse +) { + const { typ = "DIA0" } = req.query; + + if (!["DIA0", "DIA1", "DIA2"].includes(typ as string)) { + return res + .status(400) + .json({ error: "Ungültiger Typ. Nur DIA0, DIA1 oder DIA2 erlaubt." }); + } + + try { + const filePath = path.join( + process.cwd(), + "mocks/device-cgi-simulator/chartsData/systemspannung15Vminus", + `${typ}.json` + ); + + const fileContent = await fs.readFile(filePath, "utf-8"); + const json = JSON.parse(fileContent); + return res.status(200).json(json); + } catch (error) { + console.error("❌ Fehler beim Lesen der Datei:", error); + return res + .status(500) + .json({ error: "Datei konnte nicht gelesen werden." }); + } +} diff --git a/pages/api/cpl/getSystemspannung15VplusHandler.ts b/pages/api/cpl/getSystemspannung15VplusHandler.ts new file mode 100644 index 0000000..deb08ec --- /dev/null +++ b/pages/api/cpl/getSystemspannung15VplusHandler.ts @@ -0,0 +1,33 @@ +import { NextApiRequest, NextApiResponse } from "next"; +import path from "path"; +import fs from "fs/promises"; + +export default async function handler( + req: NextApiRequest, + res: NextApiResponse +) { + const { typ = "DIA0" } = req.query; + + if (!["DIA0", "DIA1", "DIA2"].includes(typ as string)) { + return res + .status(400) + .json({ error: "Ungültiger Typ. Nur DIA0, DIA1 oder DIA2 erlaubt." }); + } + + try { + const filePath = path.join( + process.cwd(), + "mocks/device-cgi-simulator/chartsData/systemspannung15Vplus", + `${typ}.json` + ); + + const fileContent = await fs.readFile(filePath, "utf-8"); + const json = JSON.parse(fileContent); + return res.status(200).json(json); + } catch (error) { + console.error("❌ Fehler beim Lesen der Datei:", error); + return res + .status(500) + .json({ error: "Datei konnte nicht gelesen werden." }); + } +} diff --git a/pages/api/cpl/getSystemspannung98VminusHandler.ts b/pages/api/cpl/getSystemspannung98VminusHandler.ts new file mode 100644 index 0000000..b98434e --- /dev/null +++ b/pages/api/cpl/getSystemspannung98VminusHandler.ts @@ -0,0 +1,33 @@ +import { NextApiRequest, NextApiResponse } from "next"; +import path from "path"; +import fs from "fs/promises"; + +export default async function handler( + req: NextApiRequest, + res: NextApiResponse +) { + const { typ = "DIA0" } = req.query; + + if (!["DIA0", "DIA1", "DIA2"].includes(typ as string)) { + return res + .status(400) + .json({ error: "Ungültiger Typ. Nur DIA0, DIA1 oder DIA2 erlaubt." }); + } + + try { + const filePath = path.join( + process.cwd(), + "mocks/device-cgi-simulator/chartsData/systemspannung98Vminus", + `${typ}.json` + ); + + const fileContent = await fs.readFile(filePath, "utf-8"); + const json = JSON.parse(fileContent); + return res.status(200).json(json); + } catch (error) { + console.error("❌ Fehler beim Lesen der Datei:", error); + return res + .status(500) + .json({ error: "Datei konnte nicht gelesen werden." }); + } +} diff --git a/pages/api/cpl/getTemperaturAdWandlerHandler.ts b/pages/api/cpl/getTemperaturAdWandlerHandler.ts new file mode 100644 index 0000000..e0311e8 --- /dev/null +++ b/pages/api/cpl/getTemperaturAdWandlerHandler.ts @@ -0,0 +1,33 @@ +import { NextApiRequest, NextApiResponse } from "next"; +import path from "path"; +import fs from "fs/promises"; + +export default async function handler( + req: NextApiRequest, + res: NextApiResponse +) { + const { typ = "DIA0" } = req.query; + + if (!["DIA0", "DIA1", "DIA2"].includes(typ as string)) { + return res + .status(400) + .json({ error: "Ungültiger Typ. Nur DIA0, DIA1 oder DIA2 erlaubt." }); + } + + try { + const filePath = path.join( + process.cwd(), + "mocks/device-cgi-simulator/chartsData/temperatur-ad-wandler", + `${typ}.json` + ); + + const fileContent = await fs.readFile(filePath, "utf-8"); + const json = JSON.parse(fileContent); + return res.status(200).json(json); + } catch (error) { + console.error("❌ Fehler beim Lesen der Datei:", error); + return res + .status(500) + .json({ error: "Datei konnte nicht gelesen werden." }); + } +} diff --git a/pages/api/cpl/getTemperaturProzessorHandler.ts b/pages/api/cpl/getTemperaturProzessorHandler.ts new file mode 100644 index 0000000..bbd77f4 --- /dev/null +++ b/pages/api/cpl/getTemperaturProzessorHandler.ts @@ -0,0 +1,33 @@ +import { NextApiRequest, NextApiResponse } from "next"; +import path from "path"; +import fs from "fs/promises"; + +export default async function handler( + req: NextApiRequest, + res: NextApiResponse +) { + const { typ = "DIA0" } = req.query; + + if (!["DIA0", "DIA1", "DIA2"].includes(typ as string)) { + return res + .status(400) + .json({ error: "Ungültiger Typ. Nur DIA0, DIA1 oder DIA2 erlaubt." }); + } + + try { + const filePath = path.join( + process.cwd(), + "mocks/device-cgi-simulator/chartsData/temperatur-prozessor", + `${typ}.json` + ); + + const fileContent = await fs.readFile(filePath, "utf-8"); + const json = JSON.parse(fileContent); + return res.status(200).json(json); + } catch (error) { + console.error("❌ Fehler beim Lesen der Datei:", error); + return res + .status(500) + .json({ error: "Datei konnte nicht gelesen werden." }); + } +} diff --git a/redux/slices/systemspannung15VminusSlice.ts b/redux/slices/systemspannung15VminusSlice.ts new file mode 100644 index 0000000..cf5fd98 --- /dev/null +++ b/redux/slices/systemspannung15VminusSlice.ts @@ -0,0 +1,50 @@ +import { createSlice, PayloadAction } from "@reduxjs/toolkit"; +import { getSystemspannung15VminusThunk } from "../thunks/getSystemspannung15VminusThunk"; + +type StateType = { + DIA0: unknown[]; + DIA1: unknown[]; + DIA2: unknown[]; + isLoading: boolean; + error: string | null; +}; + +const initialState: StateType = { + DIA0: [], + DIA1: [], + DIA2: [], + isLoading: false, + error: null, +}; + +export const systemspannung15VminusSlice = createSlice({ + name: "systemspannung15Vminus", + initialState, + reducers: {}, + extraReducers: (builder) => { + builder + .addCase(getSystemspannung15VminusThunk.pending, (state) => { + state.isLoading = true; + state.error = null; + }) + .addCase( + getSystemspannung15VminusThunk.fulfilled, + ( + state, + action: PayloadAction<{ + typ: "DIA0" | "DIA1" | "DIA2"; + data: unknown[]; + }> + ) => { + state.isLoading = false; + state[action.payload.typ] = action.payload.data; + } + ) + .addCase(getSystemspannung15VminusThunk.rejected, (state, action) => { + state.isLoading = false; + state.error = action.payload as string; + }); + }, +}); + +export default systemspannung15VminusSlice.reducer; diff --git a/redux/slices/systemspannung15VplusSlice.ts b/redux/slices/systemspannung15VplusSlice.ts new file mode 100644 index 0000000..18e5a2e --- /dev/null +++ b/redux/slices/systemspannung15VplusSlice.ts @@ -0,0 +1,50 @@ +import { createSlice, PayloadAction } from "@reduxjs/toolkit"; +import { getSystemspannung15VplusThunk } from "../thunks/getSystemspannung15VplusThunk"; + +type StateType = { + DIA0: unknown[]; + DIA1: unknown[]; + DIA2: unknown[]; + isLoading: boolean; + error: string | null; +}; + +const initialState: StateType = { + DIA0: [], + DIA1: [], + DIA2: [], + isLoading: false, + error: null, +}; + +export const systemspannung15VplusSlice = createSlice({ + name: "systemspannung15Vplus", + initialState, + reducers: {}, + extraReducers: (builder) => { + builder + .addCase(getSystemspannung15VplusThunk.pending, (state) => { + state.isLoading = true; + state.error = null; + }) + .addCase( + getSystemspannung15VplusThunk.fulfilled, + ( + state, + action: PayloadAction<{ + typ: "DIA0" | "DIA1" | "DIA2"; + data: unknown[]; + }> + ) => { + state.isLoading = false; + state[action.payload.typ] = action.payload.data; + } + ) + .addCase(getSystemspannung15VplusThunk.rejected, (state, action) => { + state.isLoading = false; + state.error = action.payload as string; + }); + }, +}); + +export default systemspannung15VplusSlice.reducer; diff --git a/redux/slices/systemspannung98VminusSlice.ts b/redux/slices/systemspannung98VminusSlice.ts new file mode 100644 index 0000000..5394a2a --- /dev/null +++ b/redux/slices/systemspannung98VminusSlice.ts @@ -0,0 +1,50 @@ +import { createSlice, PayloadAction } from "@reduxjs/toolkit"; +import { getSystemspannung98VminusThunk } from "../thunks/getSystemspannung98VminusThunk"; + +type StateType = { + DIA0: unknown[]; + DIA1: unknown[]; + DIA2: unknown[]; + isLoading: boolean; + error: string | null; +}; + +const initialState: StateType = { + DIA0: [], + DIA1: [], + DIA2: [], + isLoading: false, + error: null, +}; + +export const systemspannung98VminusSlice = createSlice({ + name: "systemspannung98Vminus", + initialState, + reducers: {}, + extraReducers: (builder) => { + builder + .addCase(getSystemspannung98VminusThunk.pending, (state) => { + state.isLoading = true; + state.error = null; + }) + .addCase( + getSystemspannung98VminusThunk.fulfilled, + ( + state, + action: PayloadAction<{ + typ: "DIA0" | "DIA1" | "DIA2"; + data: unknown[]; + }> + ) => { + state.isLoading = false; + state[action.payload.typ] = action.payload.data; + } + ) + .addCase(getSystemspannung98VminusThunk.rejected, (state, action) => { + state.isLoading = false; + state.error = action.payload as string; + }); + }, +}); + +export default systemspannung98VminusSlice.reducer; diff --git a/redux/slices/temperaturAdWandlerSlice.ts b/redux/slices/temperaturAdWandlerSlice.ts new file mode 100644 index 0000000..f645b29 --- /dev/null +++ b/redux/slices/temperaturAdWandlerSlice.ts @@ -0,0 +1,50 @@ +import { createSlice, PayloadAction } from "@reduxjs/toolkit"; +import { getTemperaturAdWandlerThunk } from "../thunks/getTemperaturAdWandlerThunk"; + +type StateType = { + DIA0: unknown[]; + DIA1: unknown[]; + DIA2: unknown[]; + isLoading: boolean; + error: string | null; +}; + +const initialState: StateType = { + DIA0: [], + DIA1: [], + DIA2: [], + isLoading: false, + error: null, +}; + +export const temperaturAdWandlerSlice = createSlice({ + name: "temperaturAdWandler", + initialState, + reducers: {}, + extraReducers: (builder) => { + builder + .addCase(getTemperaturAdWandlerThunk.pending, (state) => { + state.isLoading = true; + state.error = null; + }) + .addCase( + getTemperaturAdWandlerThunk.fulfilled, + ( + state, + action: PayloadAction<{ + typ: "DIA0" | "DIA1" | "DIA2"; + data: unknown[]; + }> + ) => { + state.isLoading = false; + state[action.payload.typ] = action.payload.data; + } + ) + .addCase(getTemperaturAdWandlerThunk.rejected, (state, action) => { + state.isLoading = false; + state.error = action.payload as string; + }); + }, +}); + +export default temperaturAdWandlerSlice.reducer; diff --git a/redux/slices/temperaturProzessorSlice.ts b/redux/slices/temperaturProzessorSlice.ts new file mode 100644 index 0000000..84b3e13 --- /dev/null +++ b/redux/slices/temperaturProzessorSlice.ts @@ -0,0 +1,50 @@ +import { createSlice, PayloadAction } from "@reduxjs/toolkit"; +import { getTemperaturProzessorThunk } from "../thunks/getTemperaturProzessorThunk"; + +type StateType = { + DIA0: unknown[]; + DIA1: unknown[]; + DIA2: unknown[]; + isLoading: boolean; + error: string | null; +}; + +const initialState: StateType = { + DIA0: [], + DIA1: [], + DIA2: [], + isLoading: false, + error: null, +}; + +export const temperaturProzessorSlice = createSlice({ + name: "temperaturProzessor", + initialState, + reducers: {}, + extraReducers: (builder) => { + builder + .addCase(getTemperaturProzessorThunk.pending, (state) => { + state.isLoading = true; + state.error = null; + }) + .addCase( + getTemperaturProzessorThunk.fulfilled, + ( + state, + action: PayloadAction<{ + typ: "DIA0" | "DIA1" | "DIA2"; + data: unknown[]; + }> + ) => { + state.isLoading = false; + state[action.payload.typ] = action.payload.data; + } + ) + .addCase(getTemperaturProzessorThunk.rejected, (state, action) => { + state.isLoading = false; + state.error = action.payload as string; + }); + }, +}); + +export default temperaturProzessorSlice.reducer; diff --git a/redux/store.ts b/redux/store.ts index ddc4969..396a95b 100644 --- a/redux/store.ts +++ b/redux/store.ts @@ -30,6 +30,11 @@ import firmwareUpdateReducer from "@/redux/slices/firmwareUpdateSlice"; import confirmModalReducer from "./slices/confirmModalSlice"; import firmwareProgressReducer from "./slices/firmwareProgressSlice"; import systemspannung5VplusReducer from "./slices/systemspannung5VplusSlice"; +import systemspannung15VminusReducer from "./slices/systemspannung15VminusSlice"; +import systemspannung15VplusReducer from "./slices/systemspannung15VplusSlice"; +import systemspannung98VminusReducer from "./slices/systemspannung98VminusSlice"; +import temperaturAdWandlerReducer from "./slices/temperaturAdWandlerSlice"; +import temperaturProzessorReducer from "./slices/temperaturProzessorSlice"; const store = configureStore({ reducer: { @@ -62,6 +67,11 @@ const store = configureStore({ confirmModal: confirmModalReducer, firmwareProgress: firmwareProgressReducer, systemspannung5Vplus: systemspannung5VplusReducer, + systemspannung15Vminus: systemspannung15VminusReducer, + systemspannung15Vplus: systemspannung15VplusReducer, + systemspannung98Vminus: systemspannung98VminusReducer, + temperaturAdWandler: temperaturAdWandlerReducer, + temperaturProzessor: temperaturProzessorReducer, }, }); diff --git a/redux/thunks/getSystemspannung15VminusThunk.ts b/redux/thunks/getSystemspannung15VminusThunk.ts new file mode 100644 index 0000000..146f9aa --- /dev/null +++ b/redux/thunks/getSystemspannung15VminusThunk.ts @@ -0,0 +1,15 @@ +import { createAsyncThunk } from "@reduxjs/toolkit"; +import { fetchSystemspannung15VminusService } from "@/services/fetchSystemspannung15VminusService"; + +export const getSystemspannung15VminusThunk = createAsyncThunk( + "systemspannung15Vminus/fetch", + async (typ: "DIA0" | "DIA1" | "DIA2", thunkAPI) => { + try { + const data = await fetchSystemspannung15VminusService(typ); + return { typ, data }; + } catch (error) { + console.error("Fehler in getSystemspannung15VminusThunk:", error); + return thunkAPI.rejectWithValue("Fehler beim Laden der -15V-Daten"); + } + } +); diff --git a/redux/thunks/getSystemspannung15VplusThunk.ts b/redux/thunks/getSystemspannung15VplusThunk.ts new file mode 100644 index 0000000..9f7bfe2 --- /dev/null +++ b/redux/thunks/getSystemspannung15VplusThunk.ts @@ -0,0 +1,15 @@ +import { createAsyncThunk } from "@reduxjs/toolkit"; +import { fetchSystemspannung15VplusService } from "@/services/fetchSystemspannung15VplusService"; + +export const getSystemspannung15VplusThunk = createAsyncThunk( + "systemspannung15Vplus/fetch", + async (typ: "DIA0" | "DIA1" | "DIA2", thunkAPI) => { + try { + const data = await fetchSystemspannung15VplusService(typ); + return { typ, data }; + } catch (error) { + console.error("Fehler in getSystemspannung15VplusThunk:", error); + return thunkAPI.rejectWithValue("Fehler beim Laden der +15V-Daten"); + } + } +); diff --git a/redux/thunks/getSystemspannung98VminusThunk.ts b/redux/thunks/getSystemspannung98VminusThunk.ts new file mode 100644 index 0000000..e4522d2 --- /dev/null +++ b/redux/thunks/getSystemspannung98VminusThunk.ts @@ -0,0 +1,15 @@ +import { createAsyncThunk } from "@reduxjs/toolkit"; +import { fetchSystemspannung98VminusService } from "@/services/fetchSystemspannung98VminusService"; + +export const getSystemspannung98VminusThunk = createAsyncThunk( + "systemspannung98Vminus/fetch", + async (typ: "DIA0" | "DIA1" | "DIA2", thunkAPI) => { + try { + const data = await fetchSystemspannung98VminusService(typ); + return { typ, data }; + } catch (error) { + console.error("Fehler in getSystemspannung98VminusThunk:", error); + return thunkAPI.rejectWithValue("Fehler beim Laden der -98V-Daten"); + } + } +); diff --git a/redux/thunks/getTemperaturAdWandlerThunk.ts b/redux/thunks/getTemperaturAdWandlerThunk.ts new file mode 100644 index 0000000..1fb8507 --- /dev/null +++ b/redux/thunks/getTemperaturAdWandlerThunk.ts @@ -0,0 +1,15 @@ +import { createAsyncThunk } from "@reduxjs/toolkit"; +import { fetchTemperaturAdWandlerService } from "@/services/fetchTemperaturAdWandlerService"; + +export const getTemperaturAdWandlerThunk = createAsyncThunk( + "temperaturAdWandler/fetch", + async (typ: "DIA0" | "DIA1" | "DIA2", thunkAPI) => { + try { + const data = await fetchTemperaturAdWandlerService(typ); + return { typ, data }; + } catch (error) { + console.error("Fehler in getTemperaturAdWandlerThunk:", error); + return thunkAPI.rejectWithValue("Fehler beim Laden der Temperaturdaten"); + } + } +); diff --git a/redux/thunks/getTemperaturProzessorThunk.ts b/redux/thunks/getTemperaturProzessorThunk.ts new file mode 100644 index 0000000..d30c037 --- /dev/null +++ b/redux/thunks/getTemperaturProzessorThunk.ts @@ -0,0 +1,17 @@ +import { createAsyncThunk } from "@reduxjs/toolkit"; +import { fetchTemperaturProzessorService } from "@/services/fetchTemperaturProzessorService"; + +export const getTemperaturProzessorThunk = createAsyncThunk( + "temperaturProzessor/fetch", + async (typ: "DIA0" | "DIA1" | "DIA2", thunkAPI) => { + try { + const data = await fetchTemperaturProzessorService(typ); + return { typ, data }; + } catch (error) { + console.error("Fehler in getTemperaturProzessorThunk:", error); + return thunkAPI.rejectWithValue( + "Fehler beim Laden der Prozessor-Temperaturdaten" + ); + } + } +); diff --git a/services/fetchSystemspannung15VminusService.ts b/services/fetchSystemspannung15VminusService.ts new file mode 100644 index 0000000..92efc5d --- /dev/null +++ b/services/fetchSystemspannung15VminusService.ts @@ -0,0 +1,14 @@ +export const fetchSystemspannung15VminusService = async ( + typ: "DIA0" | "DIA1" | "DIA2" +) => { + try { + const res = await fetch( + `/api/cpl/getSystemspannung15VminusHandler?typ=${typ}` + ); + if (!res.ok) throw new Error("Fehler beim Abrufen"); + return await res.json(); + } catch (err) { + console.error("❌ Fehler in fetchSystemspannung15VminusService:", err); + return null; + } +}; diff --git a/services/fetchSystemspannung15VplusService.ts b/services/fetchSystemspannung15VplusService.ts new file mode 100644 index 0000000..3b50e7f --- /dev/null +++ b/services/fetchSystemspannung15VplusService.ts @@ -0,0 +1,14 @@ +export const fetchSystemspannung15VplusService = async ( + typ: "DIA0" | "DIA1" | "DIA2" +) => { + try { + const res = await fetch( + `/api/cpl/getSystemspannung15VplusHandler?typ=${typ}` + ); + if (!res.ok) throw new Error("Fehler beim Abrufen"); + return await res.json(); + } catch (err) { + console.error("❌ Fehler in fetchSystemspannung15VplusService:", err); + return null; + } +}; diff --git a/services/fetchSystemspannung98VminusService.ts b/services/fetchSystemspannung98VminusService.ts new file mode 100644 index 0000000..c692957 --- /dev/null +++ b/services/fetchSystemspannung98VminusService.ts @@ -0,0 +1,14 @@ +export const fetchSystemspannung98VminusService = async ( + typ: "DIA0" | "DIA1" | "DIA2" +) => { + try { + const res = await fetch( + `/api/cpl/getSystemspannung98VminusHandler?typ=${typ}` + ); + if (!res.ok) throw new Error("Fehler beim Abrufen"); + return await res.json(); + } catch (err) { + console.error("❌ Fehler in fetchSystemspannung98VminusService:", err); + return null; + } +}; diff --git a/services/fetchTemperaturAdWandlerService.ts b/services/fetchTemperaturAdWandlerService.ts new file mode 100644 index 0000000..82532d5 --- /dev/null +++ b/services/fetchTemperaturAdWandlerService.ts @@ -0,0 +1,14 @@ +export const fetchTemperaturAdWandlerService = async ( + typ: "DIA0" | "DIA1" | "DIA2" +) => { + try { + const res = await fetch( + `/api/cpl/getTemperaturAdWandlerHandler?typ=${typ}` + ); + if (!res.ok) throw new Error("Fehler beim Abrufen"); + return await res.json(); + } catch (err) { + console.error("❌ Fehler in fetchTemperaturAdWandlerService:", err); + return null; + } +}; diff --git a/services/fetchTemperaturProzessorService.ts b/services/fetchTemperaturProzessorService.ts new file mode 100644 index 0000000..15bc6e3 --- /dev/null +++ b/services/fetchTemperaturProzessorService.ts @@ -0,0 +1,14 @@ +export const fetchTemperaturProzessorService = async ( + typ: "DIA0" | "DIA1" | "DIA2" +) => { + try { + const res = await fetch( + `/api/cpl/getTemperaturProzessorHandler?typ=${typ}` + ); + if (!res.ok) throw new Error("Fehler beim Abrufen"); + return await res.json(); + } catch (err) { + console.error("❌ Fehler in fetchTemperaturProzessorService:", err); + return null; + } +};