From 74dfb354f546fe6ad5255801f7fff201dec0b15c Mon Sep 17 00:00:00 2001 From: Ismail Ali Date: Sun, 9 Mar 2025 19:00:17 +0100 Subject: [PATCH] =?UTF-8?q?refactor:=20API-URL=20in=20`.env.local`=20ausge?= =?UTF-8?q?lagert=20f=C3=BCr=20zentrale=20Verwaltung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `NEXT_PUBLIC_API_PORT_3000` in `.env.local` definiert - `poiTypesSlice.js` so angepasst, dass die API-URL dynamisch aus `.env.local` geladen wird - Harte URL entfernt, jetzt konfigurierbar ohne Code-Änderung - Erfordert Neustart von Next.js, um `.env.local` zu laden --- .env.local | 1 + config/appVersion.js | 2 +- redux/slices/db/poiTypesSlice.js | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.env.local b/.env.local index 0eeebf47c..b05b3eea6 100644 --- a/.env.local +++ b/.env.local @@ -15,3 +15,4 @@ NEXT_PUBLIC_DEBUG_LOG=true # für Polylines/kabelstecken -> in Konextmenü "Station öffnen" " NEXT_PUBLIC_BASE_URL=http://192.168.10.33/talas5/devices/ NEXT_PUBLIC_API_BASE_URL=http://192.168.10.33/talas5/ClientData/WebServiceMap.asmx +NEXT_PUBLIC_API_PORT_3000=http://192.168.10.33:3000 diff --git a/config/appVersion.js b/config/appVersion.js index 2d27093f8..e1ff93af2 100644 --- a/config/appVersion.js +++ b/config/appVersion.js @@ -1,2 +1,2 @@ // /config/appVersion -export const APP_VERSION = "1.1.37"; +export const APP_VERSION = "1.1.38"; diff --git a/redux/slices/db/poiTypesSlice.js b/redux/slices/db/poiTypesSlice.js index 9f3af2872..b4bb7cb9b 100644 --- a/redux/slices/db/poiTypesSlice.js +++ b/redux/slices/db/poiTypesSlice.js @@ -3,7 +3,8 @@ import { createSlice, createAsyncThunk } from "@reduxjs/toolkit"; // API-Abruf für POI-Typen export const fetchPoiTypes = createAsyncThunk("poiTypes/fetchPoiTypes", async () => { - const response = await fetch("http://192.168.10.33:3000/api/talas_v5_DB/poiTyp/readPoiTyp"); + const API_BASE_URL = process.env.NEXT_PUBLIC_API_PORT_3000; + const response = await fetch(`${API_BASE_URL}/api/talas_v5_DB/poiTyp/readPoiTyp`); return await response.json(); });