eastern-cyan
eastern-cyan3mo ago

How to delete replaced picture in AntD

I know action props is an endpoint to upload the image. OnRemove props will trigred when remove button clicked and i call my delete image endpoint on there. but how to call delete endpoint when the file being replaced when i set maxCount={1}. What i need is to access old file name to sent to my delete endpoint to delete my uploaded image after new file is being added.
2 Replies
kapa.ai
kapa.ai3mo ago
Hi @M Farhan Zachary. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. The knowledge sources provided do not contain specific information about handling file replacements or deletions in Ant Design within the context of Refine. However, Refine does provide a <DeleteButton /> component that can be used to delete a resource. This component leverages Ant Design's <Button /> and <Popconfirm /> components and invokes the delete() data provider method to send a DELETE request to the resource end point. The resource.name is inferred from the formProps passed to <Form /> component. You can find more details in the <DeleteButton /> docs (https://refine.dev/docs/api-reference/antd/components/buttons/delete-button/). For more specific information about handling file replacements or deletions in Ant Design, I would recommend checking the official Ant Design documentation or reaching out to the Refine community for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@757407865391808603> kapa.ai is still learning and improving, please let us know how it did by reacting below