From 0bca9e6654b04f8f0b8d109147b647c55afc23d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=80=E6=A2=A6?= <3501646051@qq.com> Date: Sun, 17 May 2026 16:01:04 +0800 Subject: [PATCH] fix: prevent full page reload on login failure (401 on /auth/login) The axios 401 interceptor was redirecting to /login for every 401 response, including failed login attempts. Now it skips the redirect when the request is to /auth/login, letting the LoginView handle the error gracefully. Co-Authored-By: Claude Opus 4.7 (1M context) --- WebUI/src/api/request.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/WebUI/src/api/request.ts b/WebUI/src/api/request.ts index 404e5e9..ad320ed 100644 --- a/WebUI/src/api/request.ts +++ b/WebUI/src/api/request.ts @@ -28,6 +28,9 @@ instance.interceptors.response.use( message = data?.detail || '请求参数有误,请检查一下~' break case 401: + if (error.config?.url?.includes('/auth/login')) { + break + } message = '登录状态已失效~' window.location.href = '/login' return Promise.reject(error)