import { TypeZ5table } from '@/pages/Z_system/Z5role/type'

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

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

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

    default:
      return state
  }
}
