fix: Seite nach POI-Hinzufügen automatisch neu laden
- Problem mit der Icon-Aktualisierung nach dem Hinzufügen eines POI behoben - Temporäre Lösung: `window.location.reload()` nach `handleSubmit` - Redux bleibt weiterhin für POI-Typen aktiv, spätere Optimierung ohne Reload geplant
This commit is contained in:
29
redux/slices/db/poiTypesSlice.js
Normal file
29
redux/slices/db/poiTypesSlice.js
Normal file
@@ -0,0 +1,29 @@
|
||||
// /redux/slices/db/poiTypesSlice.js
|
||||
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");
|
||||
return await response.json();
|
||||
});
|
||||
|
||||
const poiTypesSlice = createSlice({
|
||||
name: "poiTypes",
|
||||
initialState: { data: [], status: "idle" },
|
||||
reducers: {},
|
||||
extraReducers: (builder) => {
|
||||
builder
|
||||
.addCase(fetchPoiTypes.pending, (state) => {
|
||||
state.status = "loading";
|
||||
})
|
||||
.addCase(fetchPoiTypes.fulfilled, (state, action) => {
|
||||
state.data = action.payload;
|
||||
state.status = "succeeded";
|
||||
})
|
||||
.addCase(fetchPoiTypes.rejected, (state) => {
|
||||
state.status = "failed";
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
export default poiTypesSlice.reducer;
|
||||
@@ -9,6 +9,7 @@ import gisStationsStatusDistrictReducer from "./slices/webService/gisStationsSta
|
||||
import gisStationsMeasurementsReducer from "./slices/webService/gisStationsMeasurementsSlice";
|
||||
import gisSystemStaticReducer from "./slices/webService/gisSystemStaticSlice";
|
||||
import gisStationsStaticReducer from "./slices/webService/gisStationsStaticSlice";
|
||||
import poiTypesReducer from "./slices/db/poiTypesSlice";
|
||||
|
||||
export const store = configureStore({
|
||||
reducer: {
|
||||
@@ -21,5 +22,6 @@ export const store = configureStore({
|
||||
gisStationsMeasurements: gisStationsMeasurementsReducer,
|
||||
gisSystemStatic: gisSystemStaticReducer,
|
||||
gisStationsStatic: gisStationsStaticReducer,
|
||||
poiTypes: poiTypesReducer,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user