IO-117 Deleting docuemnts server side.

This commit is contained in:
Patrick Fic
2021-06-08 16:59:16 -07:00
parent ef06e67c9f
commit 0fa214f029
2 changed files with 14 additions and 18 deletions

View File

@@ -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: {

View File

@@ -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]]);
}