import { TypeD2list } from '@/pages/D_storeManage/D2storSet/type'

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

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

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

    default:
      return state
  }
}
