@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.
@@ -3879,7 +3879,6 @@ var __publicField = (obj, key, value) => {
3879
3879
  throw new Error(`Attachment ${attachmentId} not found`);
3880
3880
  let oldFile = void 0;
3881
3881
  const newSha1 = await hashFile(newFile);
3882
- console.log(attachment, newFile);
3883
3882
  const performRequest2 = async () => {
3884
3883
  oldFile = await this.client.files.fetchCache(attachment.file_sha1);
3885
3884
  if (!oldFile) {
@@ -3894,7 +3893,6 @@ var __publicField = (obj, key, value) => {
3894
3893
  store.dispatch(updateAttachment(attachment));
3895
3894
  throw e;
3896
3895
  });
3897
- console.log(fileProps);
3898
3896
  const promise2 = this.enqueueRequest({
3899
3897
  description: "Edit attachment",
3900
3898
  method: HttpMethod.PATCH,
@@ -3926,7 +3924,6 @@ var __publicField = (obj, key, value) => {
3926
3924
  file_sha1: newSha1,
3927
3925
  file: URL.createObjectURL(newFile)
3928
3926
  };
3929
- console.log(offlineAttachment);
3930
3927
  const promise = performRequest2();
3931
3928
  return [offlineAttachment, promise];
3932
3929
  }
@@ -4004,7 +4001,7 @@ var __publicField = (obj, key, value) => {
4004
4001
  * @returns {Promise<TokenPair>} The new access and refresh tokens
4005
4002
  */
4006
4003
  __publicField(this, "_getRenewedTokens", async (refreshToken) => {
4007
- const response = await this.enqueueRequest({
4004
+ const promise = this.enqueueRequest({
4008
4005
  description: "Get renewed tokens",
4009
4006
  method: HttpMethod.POST,
4010
4007
  url: "/api/token/refresh/",
@@ -4017,6 +4014,14 @@ var __publicField = (obj, key, value) => {
4017
4014
  // Don't wait for other requests to finish, or we might end up in a deadlock.
4018
4015
  immediate: true
4019
4016
  });
4017
+ let response = void 0;
4018
+ try {
4019
+ response = await promise;
4020
+ } catch (e) {
4021
+ await this.logout();
4022
+ }
4023
+ if (!response)
4024
+ throw new Error("No response");
4020
4025
  if (!response.access)
4021
4026
  throw new Error("Missing access token");
4022
4027
  if (!response.refresh)