fix: korrigiere fetchGisLinesStatusService für WebService-Antwort 'Statis'
- ersetzt Zugriff auf json.Lines durch json.Statis - behebt leeren Redux-State bei Linienstatus - Daten aus Webservice fließen jetzt korrekt in gisLinesStatusSlice
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// /redux/slices/database/gisLinesSlice.js
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
import { fetchGisLinesThunk } from "../../thunks/database/fetchGisLinesThunk";
|
||||
|
||||
|
||||
33
redux/slices/webService/gisLinesStatusSlice.js
Normal file
33
redux/slices/webService/gisLinesStatusSlice.js
Normal file
@@ -0,0 +1,33 @@
|
||||
// /redux/slices/webservice/gisLinesStatusSlice.js
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
import { fetchGisLinesStatusThunk } from "../../thunks/webservice/fetchGisLinesStatusThunk";
|
||||
|
||||
const initialState = {
|
||||
data: [],
|
||||
status: "idle",
|
||||
error: null,
|
||||
};
|
||||
|
||||
export const gisLinesStatusSlice = createSlice({
|
||||
name: "gisLinesStatus",
|
||||
initialState,
|
||||
reducers: {},
|
||||
extraReducers: (builder) => {
|
||||
builder
|
||||
.addCase(fetchGisLinesStatusThunk.pending, (state) => {
|
||||
state.status = "loading";
|
||||
})
|
||||
.addCase(fetchGisLinesStatusThunk.fulfilled, (state, action) => {
|
||||
state.status = "succeeded";
|
||||
state.data = action.payload;
|
||||
})
|
||||
.addCase(fetchGisLinesStatusThunk.rejected, (state, action) => {
|
||||
state.status = "failed";
|
||||
state.error = action.payload;
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
export default gisLinesStatusSlice.reducer;
|
||||
|
||||
export const selectGisLinesStatus = (state) => state.gisLinesStatus;
|
||||
34
redux/slices/webService/userRightsSlice.js
Normal file
34
redux/slices/webService/userRightsSlice.js
Normal file
@@ -0,0 +1,34 @@
|
||||
// /redux/slices/webservice/userRightsSlice.js
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
import { fetchUserRightsThunk } from "../../thunks/webservice/fetchUserRightsThunk";
|
||||
|
||||
const initialState = {
|
||||
rights: [],
|
||||
status: "idle",
|
||||
error: null,
|
||||
};
|
||||
|
||||
export const userRightsSlice = createSlice({
|
||||
name: "userRights",
|
||||
initialState,
|
||||
reducers: {},
|
||||
extraReducers: (builder) => {
|
||||
builder
|
||||
.addCase(fetchUserRightsThunk.pending, (state) => {
|
||||
state.status = "loading";
|
||||
})
|
||||
.addCase(fetchUserRightsThunk.fulfilled, (state, action) => {
|
||||
state.status = "succeeded";
|
||||
state.rights = action.payload;
|
||||
})
|
||||
.addCase(fetchUserRightsThunk.rejected, (state, action) => {
|
||||
state.status = "failed";
|
||||
state.error = action.payload;
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
export default userRightsSlice.reducer;
|
||||
|
||||
export const selectUserRights = (state) => state.userRights.rights;
|
||||
export const selectUserRightsStatus = (state) => state.userRights.status;
|
||||
Reference in New Issue
Block a user