Revize f8083631
Přidáno uživatelem Fantič před více než 1 rok
src/stores/reducers/planSlice.ts | ||
---|---|---|
1 | 1 |
import { PayloadAction, createSlice } from "@reduxjs/toolkit" |
2 | 2 |
import { PlanViewState } from "../../types/plan"; |
3 |
import { getFloorList } from "../actions/planThunks"; |
|
3 | 4 |
|
4 | 5 |
const initialState: PlanViewState = { |
5 | 6 |
lastError: "", |
6 |
|
|
7 |
|
|
7 | 8 |
|
8 | 9 |
|
9 | 10 |
// TODO backend -> retrieve list of floors, not static -> not implemented at the time of coding |
... | ... | |
23 | 24 |
initialState: initialState, |
24 | 25 |
reducers: {}, |
25 | 26 |
extraReducers: (builder) => { |
27 |
|
|
28 |
builder.addCase(getFloorList.fulfilled, (state, action) => { |
|
29 |
|
|
30 |
state.floorList = action.payload |
|
31 |
state.floorListLoading = false; |
|
32 |
}) |
|
33 |
builder.addCase(getFloorList.pending, (state, action) => { |
|
34 |
state.floorListLoading = true; |
|
35 |
}) |
|
36 |
builder.addCase(getFloorList.rejected, (state, action) => { |
|
37 |
state.floorListLoading = false; |
|
38 |
state.lastError = action.error.message |
|
39 |
}) |
|
26 | 40 |
} |
27 | 41 |
}) |
28 | 42 |
|
Také k dispozici: Unified diff
re #10844: NoteViewPage: GetPlanAll redux implementation