From 0292ed2af8127624bfb67f346e3a5d5ce24ca1b0 Mon Sep 17 00:00:00 2001 From: Lyon <88232613+pikasTech@users.noreply.github.com> Date: Mon, 22 Jun 2026 21:13:47 +0800 Subject: [PATCH] fix(workbench): keep auth transient failures off login redirect (#1924) --- web/hwlab-cloud-web/src/stores/auth.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/hwlab-cloud-web/src/stores/auth.ts b/web/hwlab-cloud-web/src/stores/auth.ts index b3fcda5c..741ae114 100644 --- a/web/hwlab-cloud-web/src/stores/auth.ts +++ b/web/hwlab-cloud-web/src/stores/auth.ts @@ -24,6 +24,13 @@ export const useAuthStore = defineStore("auth", () => { document.body.dataset.authState = "authenticated"; return; } + const explicitUnauthenticated = current.status === 401 || current.status === 403 || (current.ok && current.data?.authenticated === false); + if (!explicitUnauthenticated) { + error.value = current.error || "认证状态暂时不可达,保持当前页面并稍后重试。"; + checked.value = authState.value === "authenticated"; + document.body.dataset.authState = authState.value === "authenticated" ? "authenticated" : "checking"; + return; + } session.value = null; authState.value = "login"; checked.value = true;