From d04903fa47bbdff5fee57cd7cc27d69f0de42a16 Mon Sep 17 00:00:00 2001 From: shinya Date: Tue, 24 Jun 2025 00:13:44 +0800 Subject: [PATCH] fix: remove no password need login --- src/components/AuthProvider.tsx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/components/AuthProvider.tsx b/src/components/AuthProvider.tsx index 21ec9fc..590ac9b 100644 --- a/src/components/AuthProvider.tsx +++ b/src/components/AuthProvider.tsx @@ -15,19 +15,12 @@ export default function AuthProvider({ children }: Props) { // 登录页或 API 路径不做校验,避免死循环 if (pathname.startsWith('/login')) return; - const password = - typeof window !== 'undefined' ? localStorage.getItem('password') : null; + const password = localStorage.getItem('password'); const fullPath = typeof window !== 'undefined' ? window.location.pathname + window.location.search : pathname; - // 没有密码直接跳转登录 - if (!password) { - router.replace(`/login?redirect=${encodeURIComponent(fullPath)}`); - return; - } - // 有密码时验证 (async () => { try {