fix(poi): Fehler beim Hinzufügen von POIs behoben (Modal blieb offen)

- Falsche URL im addPoiService korrigiert (/addLocation → /addPoi)
- Redux-Status wird nach erfolgreichem Hinzufügen zurückgesetzt (resetAddPoiStatus)
- Modal schließt jetzt zuverlässig nach dem Dispatch
- Ladeanzeige "Wird hinzugefügt..." verschwindet korrekt
- Version auf 1.1.176 erhöht
This commit is contained in:
ISA
2025-05-26 13:52:17 +02:00
parent ff55481273
commit cd46401f14
12 changed files with 162 additions and 81 deletions

View File

@@ -0,0 +1,44 @@
// /redux/slices/database/pois/poiMarkersSlice.js
import { createSlice } from "@reduxjs/toolkit";
import { fetchPoiMarkersThunk } from "../../../thunks/database/pois/fetchPoiMarkersThunk";
const initialState = {
data: [],
status: "idle",
error: null,
};
const poiMarkersSlice = createSlice({
name: "poiMarkers",
initialState,
reducers: {
setPoiMarkers: (state, action) => {
state.data = action.payload;
},
clearPoiMarkers: (state) => {
state.data = [];
},
},
extraReducers: (builder) => {
builder
.addCase(fetchPoiMarkersThunk.pending, (state) => {
state.status = "loading";
})
.addCase(fetchPoiMarkersThunk.fulfilled, (state, action) => {
state.status = "succeeded";
state.data = action.payload;
})
.addCase(fetchPoiMarkersThunk.rejected, (state, action) => {
state.status = "failed";
state.error = action.error.message;
});
},
});
export const { setPoiMarkers, clearPoiMarkers } = poiMarkersSlice.actions;
export const selectPoiMarkers = (state) => state.poiMarkers.data;
export const selectPoiMarkersStatus = (state) => state.poiMarkers.status;
export const selectPoiMarkersError = (state) => state.poiMarkers.error;
export default poiMarkersSlice.reducer;