Is it possible to access meta values passed into <DeleteButton meta={...} /> on the backend?
I am using the delete button provided by @refinedev/antd. Looking at the docs, I see meta property where I can add some additional data. How do I access the values in meta when making the delete request?
6 Replies
Hi @Syn. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The
meta
property in the DeleteButton
component is used to pass additional parameters to the useDelete
hook. However, the provided extracts do not contain specific information on how to access these meta
values when making the delete request.
The DeleteButton
component in @refinedev/antd
uses the useDelete
hook directly. When you click the button, it triggers the useDelete
method and the record gets deleted. The mutate
function from useDelete
is passed to the onConfirm
prop of the Popconfirm
component, which means it invokes dataProvider.delete
upon confirmation of a delete pop up.
Here is the code snippet showing how useDelete
is used in DeleteButton
:
As you can see, the meta
values are passed to the mutate
function. However, the exact way to access these meta
values during the delete request is not specified in the provided extracts. For more detailed information, you may want to refer to the official refine documentation (https://refine.dev/docs).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@183085423604662273> kapa.ai is still learning and improving, please let us know how it did by reacting below
eastern-cyanOP•15mo ago
@kapa.ai this is an example DELETE endpoint in nextjs:
On my delete button, i have this:
How do I access the meta values within my delete request?
Let me check the knowledge base for you. One moment! :books:
----------------------
I'm sorry, but the provided extracts do not contain specific information on how to access
meta
values within a delete request in Next.js using the DeleteButton
component from @refinedev/antd
.
The meta
property in the DeleteButton
component is used to pass additional parameters to the useDelete
hook. However, how these meta
values are passed to the server-side and how to access them in your Next.js API route is not specified in the provided extracts.
For more detailed information, you may want to refer to the official refine documentation (https://refine.dev/docs) or Next.js documentation on API Routes (https://nextjs.org/docs/api-routes/introduction).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@183085423604662273> kapa.ai is still learning and improving, please let us know how it did by reacting below
ratty-blush•15mo ago
Hello @Syn,
meta
property is passed to your data provider's deleteOne
method. You can access it from there. If you are using data provider package, you can swizzle it and modify as you need. https://refine.dev/docs/guides-concepts/development/#using-swizzleDevelopment | refine
Refine offers improved developer experience by providing a set of tools to help you develop your application. These tools will help you from creating a new project to developing, customizing and debugging your application. This guide will introduce you to these tools and how to use them.