Преглед изворни кода

Fixed bug 1478

bugfix/1478
jovan.cirkovic пре 3 година
родитељ
комит
1f2336c012
1 измењених фајлова са 7 додато и 2 уклоњено
  1. 7
    2
      src/components/ImagePicker/ImagePicker.js

+ 7
- 2
src/components/ImagePicker/ImagePicker.js Прегледај датотеку

@@ -22,7 +22,6 @@ const ImagePicker = (props) => {
// Check if file is type of string or File
useEffect(() => {
if (props.image) {
if (typeof props.image === "string") {
setImage(getImageUrl(props.image, variants.offerCard));
} else {
@@ -56,6 +55,12 @@ const ImagePicker = (props) => {

// Reads image as both base64 and multipart type
const handleImage = (file) => {
if (
file.type !== "image/jpeg" &&
file.type !== "image/jpg" &&
file.type !== "image/png"
)
return;
let reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {
@@ -72,7 +77,7 @@ const ImagePicker = (props) => {
setImage("");
setIsEditing(false);
};
return (
<ImagePickerContainer
className={props.className}

Loading…
Откажи
Сачувај