diff --git a/config/webVersion.ts b/config/webVersion.ts index 87a6129..72a34ce 100644 --- a/config/webVersion.ts +++ b/config/webVersion.ts @@ -6,5 +6,5 @@ 2: Patch oder Hotfix (Bugfixes oder kleine Änderungen). */ -const webVersion = "1.6.230"; +const webVersion = "1.6.231"; export default webVersion; diff --git a/pages/api/cpl/tdrReferenceCurveAPIHandler.ts b/pages/api/cpl/tdrReferenceCurveAPIHandler.ts new file mode 100644 index 0000000..6bade55 --- /dev/null +++ b/pages/api/cpl/tdrReferenceCurveAPIHandler.ts @@ -0,0 +1,25 @@ +// /api/cpl/tdrReferenceCurveAPIHandler.ts +import { NextApiRequest, NextApiResponse } from "next"; +import path from "path"; +import { promises as fs } from "fs"; + +export default async function handler( + req: NextApiRequest, + res: NextApiResponse +) { + const { slot } = req.query; + + const filePath = path.join( + process.cwd(), + "apiMockData", + "tdr-reference-curves", + `slot${slot}.json` + ); + + try { + const fileContent = await fs.readFile(filePath, "utf-8"); + res.status(200).json(JSON.parse(fileContent)); + } catch (error) { + res.status(404).json({ error: "File not found" }); + } +} diff --git a/services/fetchTDRReferenceCurveService.ts b/services/fetchTDRReferenceCurveService.ts index 477d60e..4bfc0e7 100644 --- a/services/fetchTDRReferenceCurveService.ts +++ b/services/fetchTDRReferenceCurveService.ts @@ -13,7 +13,7 @@ export const fetchTDRReferenceCurveService = async ( // 🔁 Fallback: Datei oder Produktion-API const isDev = process.env.NEXT_PUBLIC_NODE_ENV === "development"; const url = isDev - ? `/api/cpl/tdr-reference-curves/slot${slot}.json` + ? `/api/cpl/tdrReferenceCurveAPIHandler?slot=${slot}` : `${window.location.origin}/CPL?Service/empty.acp&TDR=${slot}`; try {