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