34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
// /redux/slices/webService/gisSystemStaticSlice.js
|
|
|
|
import { createSlice, createAsyncThunk } from "@reduxjs/toolkit";
|
|
import { fetchGisSystemStaticService } from "../../../services/webservice/fetchGisSystemStaticService";
|
|
|
|
import { fetchGisSystemStaticThunk } from "../../thunks/fetchGisSystemStaticThunk";
|
|
|
|
const slice = createSlice({
|
|
name: "gisSystemStatic",
|
|
initialState: {
|
|
data: [],
|
|
status: "idle",
|
|
error: null,
|
|
},
|
|
reducers: {},
|
|
extraReducers: (builder) => {
|
|
builder
|
|
.addCase(fetchGisSystemStaticThunk.pending, (state) => {
|
|
state.status = "loading";
|
|
})
|
|
.addCase(fetchGisSystemStaticThunk.fulfilled, (state, action) => {
|
|
state.status = "succeeded";
|
|
state.data = action.payload;
|
|
})
|
|
.addCase(fetchGisSystemStaticThunk.rejected, (state, action) => {
|
|
state.status = "failed";
|
|
state.error = action.error.message;
|
|
});
|
|
},
|
|
});
|
|
|
|
export default slice.reducer;
|
|
export const selectGisSystemStatic = (state) => state.gisSystemStatic.data;
|