docs: add analog inputs architecture diagram and flow description

This commit is contained in:
Ismail Ali
2025-06-21 19:14:42 +02:00
parent d785ced9d3
commit 082ea99d20
7 changed files with 108 additions and 9 deletions

View File

@@ -21,10 +21,33 @@ export async function fetchAnalogInputsHistoryService(): Promise<
const isDev = process.env.NODE_ENV === "development";
if (isDev) {
// ⬇️ ENTWICKLUNG: über API-Handler
const response = await fetch("/api/cpl/getAnalogInputsHistory");
if (!response.ok) throw new Error("Fehler beim Laden der Mock-Daten");
return await response.json();
try {
// ⬇️ ENTWICKLUNG: über API-Handler
const response = await fetch("/api/cpl/getAnalogInputsHistory");
// 🔍 Log: Rohantwort prüfen
console.log("📡 [DEV] Raw response:", response);
if (!response.ok) {
throw new Error(
`❌ Fehler beim Laden der Mock-Daten: ${response.statusText}`
);
}
// ✅ Versuch, JSON zu parsen
const data = await response.json();
// 🔍 Log: JSON anzeigen
console.log("✅ [DEV] Parsed JSON:", data);
// 🔍 Validitätsprüfung (optional)
JSON.stringify(data); // Wenn das fehlschlägt, wird catch ausgelöst
return data;
} catch (error) {
console.error("❗ [DEV] Fehler beim Verarbeiten der JSON-Daten:", error);
return {};
}
}
// ⬇️ PRODUKTION: direkt vom CPL-Webserver holen