Components: ImageEditor: add error handler

This commit is contained in:
Viktor Fomin 2023-05-02 14:22:28 +03:00
parent 93fd498284
commit df4c90d838

View File

@ -76,6 +76,7 @@ const Dropzone = ({ t, setUploadedFile, isDisabled }) => {
timer.current = setTimeout(() => {
setLoadingFile(true);
}, 50);
try {
const imageBitMap = await createImageBitmap(file);
const width = imageBitMap.width;
@ -107,6 +108,13 @@ const Dropzone = ({ t, setUploadedFile, isDisabled }) => {
setLoadingFile(false);
}
});
} catch (error) {
toastr.error(error);
timer.current && clearTimeout(timer.current);
if (mount.current) {
setLoadingFile(false);
}
}
};
const { getRootProps, getInputProps } = useDropzone({