import { A2AListType } from '@/types'

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

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

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