@overmap-ai/core 1.0.46-project-attachments.4 → 1.0.46-project-attachments.6

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.
@@ -3687,9 +3687,7 @@ const documentSlice = createSlice({
3687
3687
  if (action.payload.filter(onlyUniqueOfflineIds).length !== action.payload.length) {
3688
3688
  throw new Error("Tried to use setIssues reducer with duplicate ID's");
3689
3689
  }
3690
- for (const document2 of action.payload) {
3691
- state.documents[document2.offline_id] = document2;
3692
- }
3690
+ state.documents = toOfflineIdRecord(action.payload);
3693
3691
  },
3694
3692
  addDocuments: (state, action) => {
3695
3693
  for (const document2 of action.payload) {
@@ -4540,7 +4538,7 @@ class AttachmentService extends BaseApiService {
4540
4538
  const promise = this.enqueueRequest({
4541
4539
  description: "Create attachment",
4542
4540
  method: HttpMethod.POST,
4543
- url: `/components/types/${project}/attach/`,
4541
+ url: `/projects/${project}/attach/`,
4544
4542
  blocks: [offline_id, project.toString()],
4545
4543
  blockers: [file_sha1],
4546
4544
  payload: {
@@ -4617,7 +4615,7 @@ class AttachmentService extends BaseApiService {
4617
4615
  return photoAttachmentPromise(file);
4618
4616
  });
4619
4617
  }
4620
- attachFilesToProjectType(filesToSubmit, projectId) {
4618
+ attachFilesToProject(filesToSubmit, projectId) {
4621
4619
  return filesToSubmit.map((file) => {
4622
4620
  if (!(file instanceof File)) {
4623
4621
  throw new Error("Expected a File instance.");
@@ -7329,7 +7327,7 @@ class DocumentService extends BaseApiService {
7329
7327
  blocks: [document2.offline_id]
7330
7328
  });
7331
7329
  promise.catch(() => {
7332
- setDocuments([documentToBeUpdated]);
7330
+ updateDocuments([documentToBeUpdated]);
7333
7331
  });
7334
7332
  const fullDocument = store.getState().documentsReducer.documents[document2.offline_id];
7335
7333
  return [fullDocument, promise];
@@ -7373,9 +7371,9 @@ class DocumentService extends BaseApiService {
7373
7371
  blocks: []
7374
7372
  });
7375
7373
  promise.then((result) => {
7376
- setDocuments(result);
7374
+ updateDocuments(result);
7377
7375
  }).catch(() => {
7378
- setDocuments(documentsToRevertIfMoveFails);
7376
+ updateDocuments(documentsToRevertIfMoveFails);
7379
7377
  });
7380
7378
  return promise;
7381
7379
  }
@@ -7400,9 +7398,9 @@ class DocumentService extends BaseApiService {
7400
7398
  promise.then((documentsToUpdate) => {
7401
7399
  store.dispatch(updateDocuments(documentsToUpdate));
7402
7400
  }).catch(() => {
7403
- store.dispatch(setDocuments([documentToBeDeleted]));
7401
+ store.dispatch(updateDocuments([documentToBeDeleted]));
7404
7402
  if (parentDocument) {
7405
- store.dispatch(setDocuments([parentDocument]));
7403
+ store.dispatch(updateDocuments([parentDocument]));
7406
7404
  }
7407
7405
  });
7408
7406
  return promise;