Authorized.js 421 Bytes
Newer Older
afc163's avatar
afc163 committed
1 2
import React from 'react';
import RenderAuthorized from '@/components/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>
);