import { B3tableType } from "@/types";

// 初始化状态
const initState = {
  // 列表数据
  B3TableList: {
    list: [] as B3tableType[],
    total: 0,
  },
};

// 定义 action 类型
type Props = {
  type: "B3/getList";
  payload: { list: B3tableType[]; total: number };
};

// reducer
export default function Reducer(state = initState, action: Props) {
  switch (action.type) {
    // 获取列表数据
    case "B3/getList":
      return { ...state, B3TableList: action.payload };
    default:
      return state;
  }
}
