diff --git a/src/components/AuthProvider.tsx b/src/components/AuthProvider.tsx index 381e276..c972a2f 100644 --- a/src/components/AuthProvider.tsx +++ b/src/components/AuthProvider.tsx @@ -18,7 +18,7 @@ export default function AuthProvider({ children }: Props) { const { siteName } = useSite(); const authenticate = useCallback(async () => { // 登录页 - if (pathname.startsWith('/login') || pathname.startsWith('/api/login')) { + if (pathname.startsWith('/login') || pathname.startsWith('/api')) { setIsAuthenticated(true); return; } @@ -30,13 +30,6 @@ export default function AuthProvider({ children }: Props) { ? window.location.pathname + window.location.search : pathname; - // 没有密码直接跳转 - if (!password) { - router.replace(`/login?redirect=${encodeURIComponent(fullPath)}`); - setIsAuthenticated(false); - return; - } - // 尝试认证 try { const res = await fetch('/api/login', {