feat: 1. 将大部分的请求从fetch改成axios方便管理。
2. 给文档类型添加入口模块和相关数据的渲染。并且给文档类型进行功能上的角色权限区分 3. 新增角色权限管理页面
This commit is contained in:
@@ -33,11 +33,11 @@ export function ClientAuthGuard({ isPublicPath }: ClientAuthGuardProps) {
|
||||
const token = localStorage.getItem('access_token');
|
||||
const authenticated = isAuthenticated();
|
||||
|
||||
console.log('🔍 [Auth Guard] 认证检查', {
|
||||
token: token ? `${token.substring(0, 20)}...` : null,
|
||||
authenticated,
|
||||
pathname: location.pathname
|
||||
});
|
||||
// console.log('🔍 [Auth Guard] 认证检查', {
|
||||
// token: token ? `${token.substring(0, 20)}...` : null,
|
||||
// authenticated,
|
||||
// pathname: location.pathname
|
||||
// });
|
||||
|
||||
if (!authenticated) {
|
||||
console.log('🔒 [Auth Guard] 未认证,重定向到登录页');
|
||||
@@ -48,7 +48,7 @@ export function ClientAuthGuard({ isPublicPath }: ClientAuthGuardProps) {
|
||||
// 跳转到登录页,并传递重定向目标
|
||||
navigate(`/login?redirect=${encodeURIComponent(redirectTo)}`, { replace: true });
|
||||
} else {
|
||||
console.log('✅ [Auth Guard] 已认证,允许访问');
|
||||
// console.log('✅ [Auth Guard] 已认证,允许访问');
|
||||
}
|
||||
}, [isPublicPath, navigate, location.pathname]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user