- ersetzt Zugriff auf json.Lines durch json.Statis - behebt leeren Redux-State bei Linienstatus - Daten aus Webservice fließen jetzt korrekt in gisLinesStatusSlice
35 lines
992 B
JavaScript
35 lines
992 B
JavaScript
// /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;
|