How to correctly display nested resource name in create hook notification ?
I am getting a notification like "Successfully created orderes/1/items" when using the useCreateMany hook with nested resource
orders/1/items
, any ideas on how to fix this.2 Replies
Hi @stevenhg. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The
useCreateMany
hook in Refine provides a successNotification
prop that allows you to customize the success notification that shows up when the data is fetched successfully. By default, the success message is "Successfully created resource
s". In your case, the resource is orders/1/items
, hence the message "Successfully created orders/1/items".
To customize this message, you can pass a function to the successNotification
prop. This function receives the data, values, and resource as arguments and should return an object with message
, description
, and type
properties.
Here's an example of how you can customize the success notification:
In the message
property, you can format the string as you wish, using the data
, values
, and resource
arguments as needed.
For more information, you can refer to the useCreateMany documentation (https://refine.dev/docs/api-reference/core/hooks/data/useCreateMany).
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------<@360760354671689728> kapa.ai is still learning and improving, please let us how it did by reacting below