@overmap-ai/core 1.0.35-debug-file.0 → 1.0.35-fix-token-refresh-loop.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3883,7 +3883,6 @@ class AttachmentService extends BaseApiService {
3883
3883
  throw new Error(`Attachment ${attachmentId} not found`);
3884
3884
  let oldFile = void 0;
3885
3885
  const newSha1 = await hashFile(newFile);
3886
- console.log(attachment, newFile);
3887
3886
  const performRequest2 = async () => {
3888
3887
  oldFile = await this.client.files.fetchCache(attachment.file_sha1);
3889
3888
  if (!oldFile) {
@@ -3898,7 +3897,6 @@ class AttachmentService extends BaseApiService {
3898
3897
  store.dispatch(updateAttachment(attachment));
3899
3898
  throw e;
3900
3899
  });
3901
- console.log(fileProps);
3902
3900
  const promise2 = this.enqueueRequest({
3903
3901
  description: "Edit attachment",
3904
3902
  method: HttpMethod.PATCH,
@@ -3930,7 +3928,6 @@ class AttachmentService extends BaseApiService {
3930
3928
  file_sha1: newSha1,
3931
3929
  file: URL.createObjectURL(newFile)
3932
3930
  };
3933
- console.log(offlineAttachment);
3934
3931
  const promise = performRequest2();
3935
3932
  return [offlineAttachment, promise];
3936
3933
  }
@@ -4008,7 +4005,7 @@ class AuthService extends BaseApiService {
4008
4005
  * @returns {Promise<TokenPair>} The new access and refresh tokens
4009
4006
  */
4010
4007
  __publicField(this, "_getRenewedTokens", async (refreshToken) => {
4011
- const response = await this.enqueueRequest({
4008
+ const promise = this.enqueueRequest({
4012
4009
  description: "Get renewed tokens",
4013
4010
  method: HttpMethod.POST,
4014
4011
  url: "/api/token/refresh/",
@@ -4021,6 +4018,14 @@ class AuthService extends BaseApiService {
4021
4018
  // Don't wait for other requests to finish, or we might end up in a deadlock.
4022
4019
  immediate: true
4023
4020
  });
4021
+ let response = void 0;
4022
+ try {
4023
+ response = await promise;
4024
+ } catch (e) {
4025
+ await this.logout();
4026
+ }
4027
+ if (!response)
4028
+ throw new Error("No response");
4024
4029
  if (!response.access)
4025
4030
  throw new Error("Missing access token");
4026
4031
  if (!response.refresh)