增加登录验证

This commit is contained in:
linxd
2025-07-14 12:04:42 +08:00
parent 56c2af09c2
commit abdafba5d9
2 changed files with 15 additions and 2 deletions

13
src/wrappers/auth.tsx Normal file
View File

@ -0,0 +1,13 @@
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" />;
}
};