Letzte TDR-Messung anzeigen für ausgewählte Slot

This commit is contained in:
ISA
2025-03-28 12:26:43 +01:00
parent e2d8bb0f05
commit 37af5702fa
14 changed files with 61 additions and 163 deletions

View File

@@ -0,0 +1,20 @@
// /services/fetchSingleTDMData.ts
export const fetchTDMDataBySlot = async (slot: number): Promise<any> => {
if (typeof window === "undefined") return null;
const isDev = process.env.NEXT_PUBLIC_NODE_ENV === "development";
const url = isDev
? `/CPLmockData/TDM/slot${slot}.json`
: `${window.location.origin}/CPL?Service/empty.acp&TDM=${slot}`;
try {
const res = await fetch(url);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return await res.json();
} catch (error) {
console.error(`❌ Fehler beim Laden von Slot ${slot}:`, error);
return null;
}
};