Files
fe_portal_frontend/src/wrappers/auth.tsx

14 lines
332 B
TypeScript
Raw Normal View History

2025-07-14 12:04:42 +08:00
import React from 'react';
import { Redirect } from 'umi';
import { message } from 'antd';
// 权限校验
export default (props: any) => {
if (localStorage.getItem('token')) {
return <div>{props.children}</div>;
} else {
// 提示后跳转
message.error('请先登录');
return <Redirect to="/login" />;
}
};