fix: preserve desktop session across restarts

This commit is contained in:
2026-06-18 23:51:30 +08:00
parent d8195bc935
commit 1523956839
4 changed files with 78 additions and 23 deletions
+4 -1
View File
@@ -19,6 +19,7 @@ export interface CreateApiClientOptions {
baseURL?: string
timeoutMs?: number
auth?: AuthBindings
clearTokensOnUnauthorized?: boolean
}
export class ApiClientError extends Error {
@@ -154,7 +155,9 @@ export function createApiClient(options: CreateApiClientOptions = {}): ApiClient
}
}
auth.clearTokens()
if (options.clearTokensOnUnauthorized !== false) {
auth.clearTokens()
}
throw markHandled(normalizeError(error))
}