/**
 * @see https://umijs.org/zh-CN/plugins/plugin-access
 * */
export default function access(initialState: { currentUser?: API.CurrentUser } | undefined) {
  const User = JSON.parse(window.sessionStorage.getItem('User') as any);
  let obj = {
    teacher: true,
    admin: true,
  }

  if (!User) {

  } else {
    let authorities = User.code

    switch (authorities) {
      case 'Administrator':
        obj = {
          teacher: true,
          admin: true,
        }
        break;

      default:
        break;
    }
  }

  return obj;
}
