refactor: .env.local und /config/urls.js aufgeräumt und initializeMap.js
This commit is contained in:
@@ -10,5 +10,5 @@ DB_PORT=3306
|
||||
#NEXT_PUBLIC_ONLINE_TILE_LAYER="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||
######################### Offline Karte
|
||||
#NEXT_PUBLIC_ONLINE_TILE_LAYER="http://127.0.0.1:3000/mapTiles/{z}/{x}/{y}.png"
|
||||
NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"
|
||||
#NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// /config/urls.js
|
||||
|
||||
// Dynamische Bestimmung der URLs basierend auf window.location.origin ohne Port
|
||||
let BASE_URL, SERVER_URL, PROXY_TARGET, ONLINE_TILE_LAYER, OFFLINE_TILE_LAYER, MAP_TILES_LAYER;
|
||||
let BASE_URL, SERVER_URL, PROXY_TARGET, OFFLINE_TILE_LAYER, MAP_TILES_LAYER;
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
// Client-seitige Logik
|
||||
@@ -11,14 +11,12 @@ if (typeof window !== "undefined") {
|
||||
BASE_URL = `${originWithoutPort}/api`; // Dynamische Basis-URL
|
||||
SERVER_URL = originWithoutPort; // Dynamisch ermittelt, ohne Port
|
||||
PROXY_TARGET = `${originWithoutPort}:3000`; // Dynamisch für einen Proxy
|
||||
//ONLINE_TILE_LAYER = `https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`;
|
||||
//OFFLINE_TILE_LAYER = `https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`;
|
||||
ONLINE_TILE_LAYER = "http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"; //Map von Talas_v5 Server
|
||||
|
||||
OFFLINE_TILE_LAYER = "http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"; //Map von Talas_v5 Server
|
||||
//ONLINE_TILE_LAYER = `${originWithoutPort}:3000/mapTiles/{z}/{x}/{y}.png`;
|
||||
//OFFLINE_TILE_LAYER = `${originWithoutPort}:3000/mapTiles/{z}/{x}/{y}.png`;
|
||||
MAP_TILES_LAYER = ONLINE_TILE_LAYER; // Standardwert
|
||||
//OFFLINE_TILE_LAYER = `https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`;
|
||||
MAP_TILES_LAYER = OFFLINE_TILE_LAYER; // Standardwert
|
||||
}
|
||||
|
||||
// Export der dynamischen Werte
|
||||
export { BASE_URL, SERVER_URL, PROXY_TARGET, ONLINE_TILE_LAYER, OFFLINE_TILE_LAYER, MAP_TILES_LAYER };
|
||||
export { BASE_URL, SERVER_URL, PROXY_TARGET, OFFLINE_TILE_LAYER, MAP_TILES_LAYER };
|
||||
|
||||
@@ -64,7 +64,7 @@ export const initializeMap = (mapRef, setMap, setOms, setMenuItemAdded, addItems
|
||||
});
|
||||
|
||||
// Füge die Tile-Layer hinzu
|
||||
L.tileLayer(urls.ONLINE_TILE_LAYER, {
|
||||
L.tileLayer(urls.OFFLINE_TILE_LAYER, {
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
||||
}).addTo(initMap);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user