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;