IO-760 Delete pictures in bulk & other minor fixes
This commit is contained in:
@@ -10,7 +10,7 @@ var cleanAxios = axios.create();
|
||||
cleanAxios.interceptors.request.eject(axiosAuthInterceptorId);
|
||||
|
||||
export const handleUpload = async (ev, context) => {
|
||||
const { uri, filename, onError, onSuccess, onProgress } = ev;
|
||||
const { uri, filename, mediaId, onError, onSuccess, onProgress } = ev;
|
||||
const { bodyshop, jobId } = context;
|
||||
|
||||
const newFile = await (await fetch(uri)).blob();
|
||||
@@ -20,8 +20,9 @@ export const handleUpload = async (ev, context) => {
|
||||
/\.[^/.]+$/,
|
||||
""
|
||||
)}`;
|
||||
return uploadToCloudinary(
|
||||
const res = await uploadToCloudinary(
|
||||
key,
|
||||
mediaId,
|
||||
extension,
|
||||
newFile.type,
|
||||
newFile,
|
||||
@@ -30,10 +31,12 @@ export const handleUpload = async (ev, context) => {
|
||||
onProgress,
|
||||
context
|
||||
);
|
||||
return res;
|
||||
};
|
||||
|
||||
export const uploadToCloudinary = async (
|
||||
key,
|
||||
mediaId,
|
||||
extension,
|
||||
fileType,
|
||||
file,
|
||||
@@ -175,9 +178,13 @@ export const uploadToCloudinary = async (
|
||||
// message: JSON.stringify(JSON.stringify(documentInsert.errors)),
|
||||
// }),
|
||||
// });
|
||||
return { success: false, error: JSON.stringify(documentInsert.errors) };
|
||||
return {
|
||||
success: false,
|
||||
error: JSON.stringify(documentInsert.errors),
|
||||
mediaId,
|
||||
};
|
||||
}
|
||||
return { success: true };
|
||||
return { success: true, mediaId };
|
||||
};
|
||||
|
||||
export function DetermineFileType(filetype) {
|
||||
|
||||
Reference in New Issue
Block a user