fix(auth): dedupe concurrent session expiry

This commit is contained in:
lingniu
2026-07-16 06:19:02 +08:00
parent ee96b8803c
commit 41e2b1ab97
4 changed files with 63 additions and 5 deletions

View File

@@ -90,7 +90,7 @@ async function request<T>(path: string, init?: RequestInit): Promise<T> {
const requestInit = token ? { ...init, headers: withAuthorization(init?.headers, token) } : init;
const response = await fetch(path, requestInit);
if (!response.ok) {
if (response.status === 401 && token && path !== '/api/v2/session') notifyUnauthorizedSession();
if (response.status === 401 && token && path !== '/api/v2/session') notifyUnauthorizedSession(token);
throw new Error(await responseErrorMessage(response));
}
const envelope = (await response.json()) as ApiEnvelope<T>;