IO-771 Reassign documents between jobs.
This commit is contained in:
@@ -54,11 +54,20 @@ export default function JobsDocumentsGalleryReassign({ galleryImages }) {
|
||||
|
||||
const res = await axios.post("/media/rename", {
|
||||
documents: selectedImages.map((i) => {
|
||||
return { id: i.id, from: i.key, to: i.key.replace("null", jobid) };
|
||||
//Need to check if the current key folder is null, or another job.
|
||||
const currentKeys = i.key.split("/");
|
||||
currentKeys[1] = jobid;
|
||||
currentKeys.join("/");
|
||||
return { id: i.id, from: i.key, to: currentKeys.join("/") };
|
||||
}),
|
||||
});
|
||||
|
||||
console.log(res.data);
|
||||
res.data
|
||||
.filter((d) => d.error)
|
||||
.forEach((d) => {
|
||||
notification["error"]({ message: t("documents.errors.updating") });
|
||||
console.error("Error updating job document", d);
|
||||
});
|
||||
|
||||
const proms = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user