Authorized.js 421 B

12345678910111213
  1. import React from 'react';
  2. import RenderAuthorized from '@/components/Authorized';
  3. import { getAuthority } from '@/utils/authority';
  4. import Redirect from 'umi/redirect';
  5. const Authority = getAuthority();
  6. const Authorized = RenderAuthorized(Authority);
  7. export default ({ children }) => (
  8. <Authorized authority={children.props.route.authority} noMatch={<Redirect to="/user/login" />}>
  9. {children}
  10. </Authorized>
  11. );