Commit 801109ed authored by ι™ˆεΈ…'s avatar ι™ˆεΈ…

Delete redundant code

parent 09afe058
import React from 'react'; import React from 'react';
import RenderAuthorized from '@/components/Authorized'; import RenderAuthorized from '@/components/Authorized';
import Exception from '@/components/Exception';
import { getAuthority } from '@/utils/authority'; import { getAuthority } from '@/utils/authority';
import { formatMessage } from 'umi/locale';
import Link from 'umi/link';
import Redirect from 'umi/redirect'; import Redirect from 'umi/redirect';
const Authority = getAuthority(); const Authority = getAuthority();
const Authorized = RenderAuthorized(Authority); const Authorized = RenderAuthorized(Authority);
export default ({ children }) => { export default ({ children }) => (
let noMatch = ( <Authorized authority={children.props.route.authority} noMatch={<Redirect to="/user/login" />}>
<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} {children}
</Authorized> </Authorized>
); );
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment