import { A1ListType } from "@/types";

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

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

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