import { A4ListType } from '@/pages/A4antique/data'

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

// 定义 action 类型
type Props = {
  type: 'A4/getList'
  payload: { list: A4ListType[]; total: number }
}

// reducer
export default function userReducer(state = initState, action: Props) {
  switch (action.type) {
    // 获取列表数据
    case 'A4/getList':
      return { ...state, tableInfo: action.payload }

    default:
      return state
  }
}
