Browse Source

show error message when image upload does not work

Ramona Plogmann 1 year ago
parent
commit
7529660232

+ 8 - 2
client/src/components/Images/ImageUpload.jsx

@@ -145,7 +145,7 @@ const ImageUpload = (props) => {
       data.append('name', name);
       data.append('image', image);
 
-      onChangeUploadedImages(uploadedImages.filter(i => i !== image))
+      onChangeUploadedImages(uploadedImages.filter(i => i !== image));
 
       axios.post(serverURL + "/images/addImage/" + folderParam, data, {})
            .then(res => {
@@ -162,7 +162,13 @@ const ImageUpload = (props) => {
              } else {
                onChangeUploadedImages(res.data.Image);
              }
-           }).catch(err => {console.log(err)});
+           })
+           .catch(err => {
+             console.log('upload failed', err);
+             updatePhotosToUpload([]);
+             setRejectMessages(Array.from(['upload of image ' + image.name + ' failed. Reason: ' + err]));
+             setRejectMessageVisible(true);
+           });
     })
   }
 

+ 0 - 2
client/src/components/Settings/EditProfile.jsx

@@ -210,8 +210,6 @@ const EditProfile = () => {
 const EditProfileWrapper = () => {
   let { state } = useLocation();
 
-  console.log('here in the checker');
-
   if (!state || !state.userData) {
     return <Navigate to="/settings" replace />;
   }