/**
 * @see https://umijs.org/zh-CN/plugins/plugin-access
 * */
export default function access(initialState) {
  const { menuAccess,roleAlias } = initialState || {};
  if(roleAlias=='org'){
    return {
      admin:false,
      org:true
    }
  }else if(roleAlias=='admin'){
    return {
      admin:true,
      org:false
    }
  }
  return (menuAccess || []).reduce((acc, item) => {
    const { permission, canAccess } = item;
    return {
      ...acc,
      [permission]: canAccess,
    };
  }, {});
}
