import { C1tableType } from '@/types'

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

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

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

    default:
      return state
  }
}
