Datasheet Markdown
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
// /redux/api/fromDB/fetchLocationDevices.js
|
||||
// /redux/slices/webService/gisStationsStaticSlice.js
|
||||
// das ist für Datasheet dropdownmenu Bereiche/Area-Name
|
||||
import { createSlice, createAsyncThunk } from "@reduxjs/toolkit";
|
||||
|
||||
// API-Fetch-Funktion für GIS Stations Static mit dynamischem URL-Parameter
|
||||
export const fetchGisStationsStatic = createAsyncThunk("gisStationsStatic/fetchGisStationsStatic", async (_, { rejectWithValue }) => {
|
||||
try {
|
||||
const apiBaseUrl = `${window.location.origin}/talas5/ClientData/WebServiceMap.asmx`;
|
||||
const host = window.location.hostname;
|
||||
const protocol = window.location.protocol;
|
||||
const apiPort = 80; // Oder aus einer Umgebungsvariable
|
||||
const apiBaseUrl = `${protocol}//${host}:${apiPort}/talas5/ClientData/WebServiceMap.asmx`;
|
||||
|
||||
// URL-Parameter aus der aktuellen Browser-URL holen
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const idMap = params.get("idMap") || "12"; // Standardwert "12", falls `idMap` nicht existiert
|
||||
const idMap = params.get("m");
|
||||
|
||||
const url = `${apiBaseUrl}/GisStationsStatic?idMap=${idMap}`;
|
||||
console.log("📡 API Request URL:", url);
|
||||
console.log("📡 API Request URL in redux slice:", url);
|
||||
|
||||
const response = await fetch(url);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user