Show login progress immediately and stop auth 401 hangs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-08-12 20:03:34 +08:00
parent f92cb85a4a
commit 5bcaf7fd2d
10 changed files with 152 additions and 74 deletions

View file

@ -218,6 +218,12 @@ async function apiPost(path, body) {
data = null;
}
if (res.status === 401) {
const isAuthEndpoint =
url.includes("/admin/api/auth/login") || url.includes("/admin/api/auth/bootstrap");
// Login/bootstrap must never hang on the never-resolving 401 sentinel.
if (isAuthEndpoint) {
return data && typeof data === "object" ? data : { ok: false, error: "unauthorized" };
}
scheduleReauthAfter401(url);
return await _haltAfter401();
}