33 lines
1013 B
JavaScript
33 lines
1013 B
JavaScript
// /redux/slices/webService/gisStationsStatusDistrictSlice.js
|
|
|
|
import { createSlice } from "@reduxjs/toolkit";
|
|
|
|
import { fetchGisStationsStatusDistrictThunk } from "../../thunks/webservice/fetchGisStationsStatusDistrictThunk";
|
|
|
|
const slice = createSlice({
|
|
name: "gisStationsStatusDistrict",
|
|
initialState: {
|
|
data: [],
|
|
status: "idle",
|
|
error: null,
|
|
},
|
|
reducers: {},
|
|
extraReducers: (builder) => {
|
|
builder
|
|
.addCase(fetchGisStationsStatusDistrictThunk.pending, (state) => {
|
|
state.status = "loading";
|
|
})
|
|
.addCase(fetchGisStationsStatusDistrictThunk.fulfilled, (state, action) => {
|
|
state.status = "succeeded";
|
|
state.data = action.payload;
|
|
})
|
|
.addCase(fetchGisStationsStatusDistrictThunk.rejected, (state, action) => {
|
|
state.status = "failed";
|
|
state.error = action.error.message;
|
|
});
|
|
},
|
|
});
|
|
|
|
export default slice.reducer;
|
|
export const selectGisStationsStatusDistrict = (state) => state.gisStationsStatusDistrict.data;
|