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;
|
||||
Reference in New Issue
Block a user