import { B4tableType } from "@/types";

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

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

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