fix: digital Inputs Modal
This commit is contained in:
@@ -26,12 +26,13 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
"mocks/device-cgi-simulator/SERVICE/digitalInputsMockData.js"
|
||||
);
|
||||
const fileContent = fs.readFileSync(jsPath, "utf-8");
|
||||
//console.log("📡 JSMOCK-Daten geladen fileContent:", fileContent);
|
||||
|
||||
const extractArray = (name: string) => {
|
||||
const extractArray = (label: string) => {
|
||||
const match = fileContent.match(
|
||||
new RegExp(`var\\s+${name}\\s*=\\s*\\[([\\s\\S]*?)\\];`)
|
||||
new RegExp(`var\\s+${label}\\s*=\\s*\\[([\\s\\S]*?)\\];`)
|
||||
);
|
||||
if (!match) throw new Error(`Feld ${name} nicht gefunden`);
|
||||
if (!match) throw new Error(`Feld ${label} nicht gefunden`);
|
||||
return match[1]
|
||||
.split(",")
|
||||
.map((s) => s.trim().replace(/^["']|["']$/g, ""));
|
||||
@@ -49,7 +50,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
win_de_offline: extractArray("win_de_offline").map(Number),
|
||||
win_de_label: extractArray("win_de_label"),
|
||||
};
|
||||
console.log("📡 JSMOCK-Daten geladen:", data);
|
||||
//console.log("📡 JSMOCK-Daten geladen in api in jsmock:", data);
|
||||
|
||||
return res.status(200).json(data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user