Sfoglia il codice sorgente

Fixed bug 1478

bugfix/1478
jovan.cirkovic 3 anni fa
parent
commit
1f2336c012
1 ha cambiato i file con 7 aggiunte e 2 eliminazioni
  1. 7
    2
      src/components/ImagePicker/ImagePicker.js

+ 7
- 2
src/components/ImagePicker/ImagePicker.js Vedi File

@@ -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…
Annulla
Salva