import { TypeZ4Tree } from '@/pages/Z_system/Z4organization/type'

// 初始化状态
const initState = {
  // 树数据
  treeData: [] as TypeZ4Tree[]
}

// 定义 action 类型
type Props = {
  type: 'Z4/getTree'
  payload: TypeZ4Tree[]
}

// reducer
export default function Reducer(state = initState, action: Props) {
  switch (action.type) {
    // 获取树数据
    case 'Z4/getTree':
      return { ...state, treeData: action.payload }

    default:
      return state
  }
}
