fix warnings console & fix bug upload img)

This commit is contained in:
ehsanahmadi456
2025-03-31 18:26:50 +03:30
parent de3620c7fd
commit b09957f97c
2 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -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 }) {
+6 -4
View File
@@ -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