fix: fixes issue where a renewed session would in some cases would not save to disk, causing a reauthentication prompt to occur
This commit is contained in:
@@ -99,7 +99,12 @@ export class HttpService implements HttpServiceInterface {
|
||||
}
|
||||
|
||||
async runHttp<T>(httpRequest: HttpRequest): Promise<HttpResponse<T>> {
|
||||
if (this.inProgressRefreshSessionPromise) {
|
||||
if (this.__latencySimulatorMs) {
|
||||
await sleep(this.__latencySimulatorMs, true)
|
||||
}
|
||||
|
||||
const isRefreshRequest = httpRequest.url === joinPaths(this.host, Paths.v1.refreshSession)
|
||||
if (this.inProgressRefreshSessionPromise && !isRefreshRequest) {
|
||||
await this.inProgressRefreshSessionPromise
|
||||
|
||||
httpRequest.authentication = this.session?.accessToken.value
|
||||
@@ -107,17 +112,13 @@ export class HttpService implements HttpServiceInterface {
|
||||
|
||||
const request = this.createXmlRequest(httpRequest)
|
||||
|
||||
if (this.__latencySimulatorMs) {
|
||||
await sleep(this.__latencySimulatorMs, true)
|
||||
}
|
||||
|
||||
const response = await this.runRequest<T>(request, this.createRequestBody(httpRequest))
|
||||
|
||||
if (response.meta) {
|
||||
this.updateMetaCallback?.(response.meta)
|
||||
}
|
||||
|
||||
if (response.status === HttpStatusCode.ExpiredAccessToken) {
|
||||
if (response.status === HttpStatusCode.ExpiredAccessToken && !isRefreshRequest) {
|
||||
if (this.inProgressRefreshSessionPromise) {
|
||||
await this.inProgressRefreshSessionPromise
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user