没有为 key reducer 提供 reducer (reducer undefined)

No reducer provided for key reducer (reducer underfine)

我在用户 authReduce 时遇到错误。当记录这个减速器并显示 "underfine" 我正在使用:

有时我会尝试热重载它工作。所以我不明白为什么?

当我将reducer和actions存储在同一个文件中时出现问题(在一个文件中有太多exports)所以我通过拆分reducer(authReducer.js)和actions([=22)的方式解决了这个问题=]) 是这样的两个文件:

// authReducer.js

import { createSlice } from '@reduxjs/toolkit';

export const authSlice = createSlice({
  name: 'auth',
  initialState: {
    isLoading: true,
    userToken: null,
    isUserGuest: true,
    isJailBroken: false,
    isSubscription: true,
    isShowCheckPassCode: false,
    passCodeMessage: 'Đây là phiên bản nội bộ, Vui lòng nhập pass để sử dụng.',
    passCode: '',
    isShowPopupPassword: false,
    userEmail:'',
    typeLogin:'',
    isShowLoginGGFB:true
  },
  reducers: {
    signIn: {
      reducer(state, action) {
        const { token } = action.payload;
        state.userToken = token
        state.isLoading = false
      },
      prepare(token, userInfo) {
        return { payload: { token, userInfo } }
      }
    },
    skipAuth(state, action) {
      state.isUserGuest = true;
      state.userToken = null;
    },
    signout(state, action) {
      state.userToken = null
      state.isUserGuest = false;
    },
    setIsJailBroken(state, action) {
      state.isJailBroken = true
    },
    setSubscriptionNoti(state, action) {
      state.isSubscription = action.payload
    },
    setIsShowCheckPassCode(state, action) {
      state.isShowCheckPassCode = action.payload
    },
    setDataPasscode(state, action) {
      state.isShowCheckPassCode = action.payload.isShowCheckPassCode
      state.passCodeMessage = action.payload.passCodeMessage
      state.passCode = action.payload.passCode
    },
    setShowLoginGGFB(state, action){
      state.isShowLoginGGFB = action.payload
    },
    setActivePopupPassword(state, action) {
      state.isShowPopupPassword = action.payload
    },
    setUserEmail(state,action){
      state.userEmail = action.payload
    },
    setTypeLogin(state,action){
      state.typeLogin = action.payload
    }
  }
})

export const authReducer = authSlice.reducer

// authSlice.js

export const {
  signIn,
  signout,
  restore,
  skipAuth,
  setIsJailBroken,
  setSubscriptionNoti,
  setIsShowCheckPassCode,
  setDataPasscode,
  setActivePopupPassword,
  setUserEmail,
  setTypeLogin,
  setShowLoginGGFB,
} = authSlice.actions;

export const callActionSignOut = (isForce = true) => async dispatch => {
  try {
    if (isForce) {
      await signOut();
    }
    dispatch(signout());
    dispatch(
      setFavorite({
        dataFavorite: [],
        objectDataFavorite: {},
      }),
    );
    dispatch(fetchCartSuccess(null));
    dispatch(resetUserInternal());
    dispatch(clearUser());
  } catch (error) {
    console.log('callActionSignOut -> error', error);
  }
};