refactor: API-Port-Variable entfernt, dynamische Port-Nutzung eingeführt

- NEXT_PUBLIC_API_PORT_3000 entfernt
- API-Aufrufe basieren jetzt auf window.location.hostname:3000
- kein Rebuild mehr bei IP-Änderung nötig
- .env.local aufgeräumt
- CHANGELOG.md auf 1.1.68 aktualisiert
This commit is contained in:
ISA
2025-05-16 07:37:25 +02:00
parent 06028ccb6f
commit 69830a1185
7 changed files with 141 additions and 4 deletions

View File

@@ -3,7 +3,16 @@ import { createSlice, createAsyncThunk } from "@reduxjs/toolkit";
// API-Abruf für POI-Typen
export const fetchPoiTypes = createAsyncThunk("poiTypes/fetchPoiTypes", async () => {
const API_BASE_URL = process.env.NEXT_PUBLIC_API_PORT_3000;
let API_BASE_URL = "";
if (typeof window !== "undefined") {
// Browser
API_BASE_URL = `${window.location.protocol}//${window.location.hostname}:3000`;
} else {
// Server (z.B. SSR)
API_BASE_URL = "http://localhost:3000"; // oder env-Fallback z.B. process.env.API_BASE_URL
}
const response = await fetch(`${API_BASE_URL}/api/talas_v5_DB/poiTyp/readPoiTyp`);
return await response.json();
});