import React, { useState } from "react"; import { backendImg } from "@utils/helper"; import { apiRequest } from "@api/request"; import close from "assets/icons/closeProjectPersons.svg"; const FileTracker = ({ file, setDeletedTask, taskId }) => { const [openImg, setOpenImg] = useState(false); function deleteFile(file) { apiRequest("/file/detach", { method: "DELETE", data: { file_id: file.id, entity_type: 2, entity_id: taskId, status: 0 } }).then(() => { setDeletedTask(file); }); } return (
{ if (openImg) setOpenImg(!openImg); }} > img { if (!openImg) setOpenImg(!openImg); }} /> {!openImg && (
deleteFile(file)}> delete
)}
); }; export default FileTracker;