Authorized.js 427 Bytes
Newer Older
afc163's avatar
afc163 committed
1
import React from 'react';
2
import RenderAuthorized from 'ant-design-pro/lib/Authorized';
3
import { getAuthority } from '@/utils/authority';
4
import Redirect from 'umi/redirect';
afc163's avatar
afc163 committed
5

6 7
const Authority = getAuthority();
const Authorized = RenderAuthorized(Authority);
afc163's avatar
afc163 committed
8

้™ˆๅธ…'s avatar
้™ˆๅธ… committed
9 10 11 12 13
export default ({ children }) => (
  <Authorized authority={children.props.route.authority} noMatch={<Redirect to="/user/login" />}>
    {children}
  </Authorized>
);