/*
 * @Author: your name
 * @Date: 2021-09-03 14:28:27
 * @LastEditTime: 2021-10-09 09:40:42
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /MedicalWisdomCheckSys/src/access.ts
 */
/**
 * @see https://umijs.org/zh-CN/plugins/plugin-access
 * */


type menuDataItemType = {
  path: string,
  name: string,
  icon: any,
  component: string,
  children?: menuDataItemType[]
}

export default  function access(initialState: { currentUser?: API.CurrentUser | undefined,menu: menuDataItemType[],isDev: boolean}) {
  // const { currentUser,menu,isDev } = initialState || {};
  return {
    // canAdmin: currentUser && currentUser.access === 'admin',
    // normalRouteFilter:(route: any)=>{
    //     const routePathArr = menu.map(t=>(t.path));
    //     // console.log({routePathArr,route});
    //     // console.log(routePathArr.includes(route.path));
    //     //开发环境无视菜单权限
    //     return isDev?true:routePathArr.includes(route.path)
    // }
    canAdmin: true,
    normalRouteFilter:(route: any)=>{
      return true;
    }
  };
  
}
