生产管理系统 - 登录页面,注册页面改成nextjs router 跳转

This commit is contained in:
2025-11-04 10:59:23 +08:00
parent e73b4e73ad
commit aec67101cb
3 changed files with 21 additions and 7 deletions

View File

@@ -21,8 +21,8 @@ export function ClientAuthInterceptor({ children }: ClientAuthInterceptorProps)
const currentPath = window.location.pathname;
// 如果已经在认证页面(包括 /login 开头的所有路径),不需要重定向
if (currentPath.startsWith('/login')) {
// 如果已经在认证页面(包括 /login 开头的所有路径、/register 和根路径),不需要重定向
if (currentPath.startsWith('/login') || currentPath === '/register' || currentPath === '/') {
console.log(`📄 已在认证页面,跳过拦截: ${currentPath}`);
return;
}
@@ -47,8 +47,8 @@ export function ClientAuthInterceptor({ children }: ClientAuthInterceptorProps)
return <LoadingScreen variant="auth" />;
}
// 如果在认证页面(包括 /login 开头的所有路径),直接渲染子组件,不需要认证检查
if (currentPath.startsWith('/login')) {
// 如果在认证页面(包括 /login 开头的所有路径、/register 和根路径),直接渲染子组件,不需要认证检查
if (currentPath.startsWith('/login') || currentPath === '/register' || currentPath === '/') {
return <>{children}</>;
}