import { A61tableType } from '@/pages/A6_1codeSuo/type'

// 初始化状态
const initState = {
  // 列表数据
  tableInfo1: {
    list: [] as A61tableType[],
    total: 0
  },
  tableInfo2: {
    list: [] as A61tableType[],
    total: 0
  }
}

// 定义 action 类型
type Props =
  | {
      type: 'A61/getList1'
      payload: { list: A61tableType[]; total: number }
    }
  | {
      type: 'A61/getList2'
      payload: { list: A61tableType[]; total: number }
    }

// reducer
export default function Reducer(state = initState, action: Props) {
  switch (action.type) {
    // 获取列表数据
    case 'A61/getList1':
      return { ...state, tableInfo1: action.payload }
    case 'A61/getList2':
      return { ...state, tableInfo2: action.payload }
    default:
      return state
  }
}
