import { B1tableType } from '@/types'

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

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

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

    default:
      return state
  }
}
