import { D1listTypeAll } from '@/pages/D1dict/data'

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

// 定义 action 类型
type Props = {
  type: 'D1/getList'
  payload: D1listTypeAll
}

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

    default:
      return state
  }
}
