From bb14bdbf96c50c220b880675cd13d49af14ce9d8 Mon Sep 17 00:00:00 2001 From: Gavan <994259213@qq.com> Date: Wed, 23 Jul 2025 10:23:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20auth=20=E7=99=BB=E5=BD=95=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/api-templates/http-client.ejs | 2 +- ui/src/api/httpClient.ts | 2 +- ui/src/main.tsx | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ui/api-templates/http-client.ejs b/ui/api-templates/http-client.ejs index 6df6482..387faba 100644 --- a/ui/api-templates/http-client.ejs +++ b/ui/api-templates/http-client.ejs @@ -38,7 +38,7 @@ export enum ContentType { } -const whitePathnameList = ['/user/login', '/login']; +const whitePathnameList = ['/user/login', '/login', '/auth']; const whiteApiList = ['/api/v1/user/profile', '/api/v1/admin/profile']; const redirectToLogin = () => { diff --git a/ui/src/api/httpClient.ts b/ui/src/api/httpClient.ts index 26497ca..b48c1d8 100644 --- a/ui/src/api/httpClient.ts +++ b/ui/src/api/httpClient.ts @@ -58,7 +58,7 @@ export enum ContentType { Text = "text/plain", } -const whitePathnameList = ["/user/login", "/login"]; +const whitePathnameList = ["/user/login", "/login", "/auth"]; const whiteApiList = ["/api/v1/user/profile", "/api/v1/admin/profile"]; const redirectToLogin = () => { diff --git a/ui/src/main.tsx b/ui/src/main.tsx index 06c0be9..f5b82fa 100644 --- a/ui/src/main.tsx +++ b/ui/src/main.tsx @@ -45,10 +45,9 @@ const App = () => { .finally(() => { setLoading(false); }); - } else { + } else if (!location.pathname.startsWith('/auth')) { return getAdminProfile() .then((res) => { - console.log(res); setUser(res); if (location.pathname.startsWith('/login')) { onGotoRedirect('admin'); @@ -57,6 +56,8 @@ const App = () => { .finally(() => { setLoading(false); }); + } else { + setLoading(false); } };