Sfoglia il codice sorgente

Delete redundant code

陈帅 7 anni fa
parent
commit
801109ed38
1 ha cambiato i file con 5 aggiunte e 24 eliminazioni
  1. 5 24
      src/pages/Authorized.js

+ 5 - 24
src/pages/Authorized.js

@@ -1,32 +1,13 @@
 import React from 'react';
 import RenderAuthorized from '@/components/Authorized';
-import Exception from '@/components/Exception';
 import { getAuthority } from '@/utils/authority';
-import { formatMessage } from 'umi/locale';
-import Link from 'umi/link';
 import Redirect from 'umi/redirect';
 
 const Authority = getAuthority();
 const Authorized = RenderAuthorized(Authority);
 
-export default ({ children }) => {
-  let noMatch = (
-    <Exception
-      type="403"
-      desc={formatMessage({ id: 'app.exception.description.403' })}
-      linkElement={Link}
-      redirect="/user/login"
-      backText="back to login"
-    />
-  );
-  // if Authority === ['guest'] redirect to /user/login
-  // You can implement the logic here.
-  if (Authority === 'guest' || Authority.join('') === 'guest') {
-    noMatch = <Redirect to="/user/login" />;
-  }
-  return (
-    <Authorized authority={children.props.route.authority} noMatch={noMatch}>
-      {children}
-    </Authorized>
-  );
-};
+export default ({ children }) => (
+  <Authorized authority={children.props.route.authority} noMatch={<Redirect to="/user/login" />}>
+    {children}
+  </Authorized>
+);