Вам необходимо добавить ожидаемые типы действий в раздел extraReducers
в createSlice
, например:
// could use a predefined action constant if desired:
const actionFetching = "ACTION_TYPE_FETCHING"
const usersSlice = createSlice({
name: "users",
initialState,
reducers: {
// specific case reducers here
},
extraReducers: {
// could use computed key syntax with a separate type constant
[actionFetching ]: (state, action) => {}
// or the actual field name directly matching the type string
ACTION_TYPE_FULFILLED: (state, action) => {}
}
})