feat: Webservice-Mockdaten im public-Verzeichnis hinzugefügt

- JSON-Dateien für Linienstatus, Stationsstatus, Systemdaten und Benutzerrechte unter /public/mocks/webservice/ abgelegt
- Struktur der Dateien an echte Webservice-Antworten angepasst (z. B. 'Statis' statt 'Status')
- Dienste wurden entsprechend auf Umschaltung zwischen Mock- und Echtbetrieb vorbereitet
- Ermöglicht lokale Entwicklung und Tests ohne Backend-Verbindung
This commit is contained in:
ISA
2025-06-03 13:34:38 +02:00
parent 3412d3daff
commit 5c158a0395
17 changed files with 2251 additions and 46 deletions

View File

@@ -1,5 +1,3 @@
// /services/webservice/fetchUserRightsService.js
/**
* Holt Benutzerrechte aus TALAS-Webservice oder aus Mocks.
*
@@ -8,13 +6,18 @@
*/
export const fetchUserRightsService = async () => {
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
const mode = process.env.NEXT_PUBLIC_API_PORT_MODE;
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || "";
if (useMocks) {
console.log("🧪 Mock-Modus aktiviert: fetchUserRightsService");
const { mockUserRights } = await import("../../__mocks__/webservice/userRights.js");
return mockUserRights.Rights || [];
const response = await fetch("/mocks/webservice/userRights.json");
if (!response.ok) {
throw new Error("Mockdaten konnten nicht geladen werden");
}
const mockData = await response.json();
return mockData.Rights || [];
} else {
const baseUrl = `${window.location.protocol}//${window.location.hostname}:80${basePath}/ClientData/WebServiceMap.asmx`;