fix(workbench): keep auth transient failures off login redirect (#1924)

This commit is contained in:
Lyon
2026-06-22 21:13:47 +08:00
committed by GitHub
parent ce426893cd
commit 0292ed2af8
+7
View File
@@ -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;