import { D2listType } from '@/pages/D2approval/data'

// 初始化状态
const initState = {
  // 列表数据
  list: [] as D2listType[]
}

// 定义 action 类型
type Props = {
  type: 'D2/getList'
  payload: D2listType[]
}

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

    default:
      return state
  }
}
