From 0fa214f029d7a428dda6a0c8b74e2bdf93b005ed Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Tue, 8 Jun 2021 16:59:16 -0700 Subject: [PATCH] IO-117 Deleting docuemnts server side. --- ...obs-documents-gallery.delete.component.jsx | 31 ++++++++----------- client/src/redux/user/user.sagas.js | 1 + 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/client/src/components/jobs-documents-gallery/jobs-documents-gallery.delete.component.jsx b/client/src/components/jobs-documents-gallery/jobs-documents-gallery.delete.component.jsx index 9383cf979..9d3764daf 100644 --- a/client/src/components/jobs-documents-gallery/jobs-documents-gallery.delete.component.jsx +++ b/client/src/components/jobs-documents-gallery/jobs-documents-gallery.delete.component.jsx @@ -20,31 +20,26 @@ export default function JobsDocumentsDeleteButton({ ]; const [loading, setLoading] = useState(false); - console.log( - "🚀 ~ file: jobs-documents-gallery.delete.component.jsx ~ line 29 ~ imagesToDelete", - imagesToDelete - ); const handleDelete = async () => { logImEXEvent("job_documents_delete", { count: imagesToDelete.length }); setLoading(true); const res = await axios.post("/media/delete", { ids: imagesToDelete, }); - console.log( - "🚀 ~ file: jobs-documents-gallery.delete.component.jsx ~ line 31 ~ res", - res - ); + const successfulDeletes = []; - Object.keys(res.data.deleted).forEach((key) => { - if (res.data.deleted[key] !== "deleted") { - notification["error"]({ - message: t("documents.errors.deleting_cloudinary", { - message: JSON.stringify(res.data.deleted[key]), - }), - }); - } else { - successfulDeletes.push(key); - } + res.data.forEach((resType) => { + Object.keys(resType.deleted).forEach((key) => { + if (resType.deleted[key] !== "deleted") { + notification["error"]({ + message: t("documents.errors.deleting_cloudinary", { + message: JSON.stringify(resType.deleted[key]), + }), + }); + } else { + successfulDeletes.push(key); + } + }); }); const delres = await deleteDocument({ variables: { diff --git a/client/src/redux/user/user.sagas.js b/client/src/redux/user/user.sagas.js index 9a969bee0..8c56e27d3 100644 --- a/client/src/redux/user/user.sagas.js +++ b/client/src/redux/user/user.sagas.js @@ -237,6 +237,7 @@ export function* SetAuthLevelFromShopDetails({ payload }) { ); if (authRecord[0] && authRecord[0].user.validemail) { + console.log("$crisp user email", authRecord[0].user.email); window.$crisp.push(["set", "user:email", [authRecord[0].user.email]]); }