fix warnings console & fix bug upload img)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import CloseModalD from "@/components/icons/CloseModalD";
|
||||
import { styleDefault } from "@/mui";
|
||||
import { Box, Modal } from "@mui/material";
|
||||
import { styleDefault } from "@/mui";
|
||||
import Crop from "./Crop";
|
||||
|
||||
function ModalUpload({ open, handleClose, data, uploadImg }) {
|
||||
|
||||
@@ -19,9 +19,11 @@ function UploadFile({ image, setImage }) {
|
||||
|
||||
const openInput = () => fileRef.current.click();
|
||||
const handleChange = async (event) => {
|
||||
const result = await uploadImage(event);
|
||||
handleOpen();
|
||||
setData(result);
|
||||
if (!!event.target.value) {
|
||||
const result = await uploadImage(event);
|
||||
handleOpen();
|
||||
setData(result);
|
||||
}
|
||||
};
|
||||
|
||||
const uploadImg = (prop) => {
|
||||
@@ -45,7 +47,7 @@ function UploadFile({ image, setImage }) {
|
||||
/>
|
||||
<div
|
||||
onClick={openInput}
|
||||
className="flex items-center justify-start gap-[10px] cursor-pointer"
|
||||
className="flex items-center justify-start gap-[10px] cursor-pointer w-fit"
|
||||
>
|
||||
{image ? (
|
||||
<Image
|
||||
|
||||
Reference in New Issue
Block a user