feat: Healthcheck um Webservices, API-Routen und .env-Prüfungen erweitert
- Externe Webservices von TALAS V5 integriert und geprüft (Statuscode + Antwortstruktur) - Eigene API-Endpunkte wie /api/talas_v5_DB/getDevices hinzugefügt und validiert - Prüfung von NEXT_PUBLIC_USE_MOCKS zur Vermeidung von Mockdaten in Produktion - Validierung der Umgebungsvariablen wie DB_HOST, DB_NAME und NODE_ENV ergänzt - Response-Status 200 bei vollständigem Erfolg, 207 bei Teilfehlern - Verbesserung der JSON-Antwortstruktur zur einfacheren Analyse
This commit is contained in:
@@ -9,9 +9,13 @@ export const fetchUserRightsService = async () => {
|
||||
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || "";
|
||||
|
||||
if (useMocks) {
|
||||
console.log("🧪 Mock-Modus aktiviert: fetchUserRightsService");
|
||||
const mockBasePath = "/api/mocks/webservice/gisSystemStatic";
|
||||
const mockURL = `${window.location.origin}${mockBasePath}`;
|
||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
||||
console.log("🧪 Mock-Modus aktiviert: fetchUserRightsService ", mockURL);
|
||||
}
|
||||
|
||||
const response = await fetch("/api/mocks/webservice/gisSystemStatic"); //gisSystemStatic enthält die Systeme (Systems) und die User Rechte (Rights)
|
||||
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");
|
||||
}
|
||||
@@ -26,7 +30,9 @@ export const fetchUserRightsService = async () => {
|
||||
const idUser = params.get("u");
|
||||
|
||||
const url = `${baseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`;
|
||||
console.log("🔍 Rechte-Fetch URL:", url);
|
||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
||||
console.log("🔍 Rechte-Fetch URL:", url);
|
||||
}
|
||||
|
||||
const response = await fetch(url, {
|
||||
method: "GET",
|
||||
@@ -40,7 +46,9 @@ export const fetchUserRightsService = async () => {
|
||||
}
|
||||
|
||||
const json = await response.json();
|
||||
console.log("👤 Rechte-Response JSON:", json);
|
||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
||||
console.log("👤 Rechte-Response JSON:", json);
|
||||
}
|
||||
|
||||
return json.Rights || [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user