feat(mock): zentrale Mock-API-Struktur eingeführt mit .env-Steuerung
- Mock-API-Endpunkte unter pages/api/mocks/webservice erstellt (JSON-basiert) - Zentrale Variable NEXT_PUBLIC_USE_MOCKS zur Modussteuerung eingeführt - fetchGis*-Services rufen je nach Modus reale oder Mockdaten ab - Alert-Hinweis im UI für aktive Mockumgebung eingebaut - .env.production sichert produktives Verhalten (Mocks deaktiviert) - mockData-Verzeichnis via .gitignore vom Repo ausgeschlossen - appVersion.js auf 1.1.231 erhöht
This commit is contained in:
@@ -5,7 +5,7 @@ export const fetchGisLinesStatusService = async () => {
|
||||
if (useMocks) {
|
||||
console.log("🧪 Mock-Modus aktiviert: fetchGisLinesStatusService");
|
||||
|
||||
const response = await fetch("/mocks/webservice/gisLinesStatus.json");
|
||||
const response = await fetch("/api/mocks/webservice/gisLinesStatus");
|
||||
if (!response.ok) {
|
||||
throw new Error("Mockdaten konnten nicht geladen werden");
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ export const fetchGisStationsMeasurementsService = async () => {
|
||||
if (useMocks) {
|
||||
console.log("🧪 Mock-Modus aktiviert: fetchGisStationsMeasurementsService");
|
||||
|
||||
const response = await fetch("/mocks/webservice/gisStationsMeasurements.json");
|
||||
const response = await fetch("/api/mocks/webservice/gisStationsMeasurements");
|
||||
if (!response.ok) {
|
||||
throw new Error("Mockdaten konnten nicht geladen werden");
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export const fetchGisStationsStaticDistrictService = async () => {
|
||||
if (useMocks) {
|
||||
console.log("🧪 Mock-Modus aktiviert: fetchGisStationsStaticDistrictService");
|
||||
|
||||
const res = await fetch("/mocks/webservice/gisStationsStaticDistrict.json");
|
||||
const res = await fetch("/api/mocks/webservice/gisStationsStaticDistrict");
|
||||
if (!res.ok) {
|
||||
throw new Error("Mockdaten konnten nicht geladen werden");
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export const fetchGisStationsStatusDistrictService = async () => {
|
||||
if (useMocks) {
|
||||
console.log("🧪 Mock-Modus aktiviert: fetchGisStationsStatusDistrictService");
|
||||
|
||||
const response = await fetch("/mocks/webservice/gisStationsStatusDistrict.json");
|
||||
const response = await fetch("/api/mocks/webservice/gisStationsStatusDistrict");
|
||||
if (!response.ok) {
|
||||
throw new Error("Mockdaten konnten nicht geladen werden");
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export const fetchGisSystemStaticService = async () => {
|
||||
if (useMocks) {
|
||||
console.log("🧪 Mock-Modus aktiviert: fetchGisSystemStaticService");
|
||||
|
||||
const response = await fetch("/mocks/webservice/gisSystemStatic.json");
|
||||
const response = await fetch("/api/mocks/webservice/gisSystemStatic");
|
||||
if (!response.ok) {
|
||||
throw new Error("Mockdaten konnten nicht geladen werden");
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export const fetchUserRightsService = async () => {
|
||||
if (useMocks) {
|
||||
console.log("🧪 Mock-Modus aktiviert: fetchUserRightsService");
|
||||
|
||||
const response = await fetch("/mocks/webservice/userRights.json");
|
||||
const response = await fetch("/api/mocks/webservice/gisSystemStatic"); //gisSystemStatic enthält die Systeme (Systems) und die User Rechte (Rights)
|
||||
if (!response.ok) {
|
||||
throw new Error("Mockdaten konnten nicht geladen werden");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user