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 CloseModalD from "@/components/icons/CloseModalD";
import { styleDefault } from "@/mui";
import { Box, Modal } from "@mui/material"; import { Box, Modal } from "@mui/material";
import { styleDefault } from "@/mui";
import Crop from "./Crop"; import Crop from "./Crop";
function ModalUpload({ open, handleClose, data, uploadImg }) { function ModalUpload({ open, handleClose, data, uploadImg }) {
+6 -4
View File
@@ -19,9 +19,11 @@ function UploadFile({ image, setImage }) {
const openInput = () => fileRef.current.click(); const openInput = () => fileRef.current.click();
const handleChange = async (event) => { const handleChange = async (event) => {
const result = await uploadImage(event); if (!!event.target.value) {
handleOpen(); const result = await uploadImage(event);
setData(result); handleOpen();
setData(result);
}
}; };
const uploadImg = (prop) => { const uploadImg = (prop) => {
@@ -45,7 +47,7 @@ function UploadFile({ image, setImage }) {
/> />
<div <div
onClick={openInput} 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 ? (
<Image <Image