// 初始化状态
import { ClueItem } from '@/types/api/clue'

const initState = {
  // 列表数据
  tableInfo: {
    list: [] as ClueItem[],
    total: 0
  }
}

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

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

    default:
      return state
  }
}
