Sub resource in antd tabs
I'm trying to get a component as a "SubResource" of some sort. I implemented a resource for "projects" with a show page, and on that page I put antd tabs.
On the first tab there is the show component for products. On the second tab, I'd like a list component for that subresource (project admins) and the url to reflect something along the lines of "projects/:id/projects-admin".
5 Replies
Hi @Raekh. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the information provided in the extracts, you can use the
resource
prop in the Show
, Edit
, Create
, and List
components to specify a custom resource. However, the extracts do not provide specific information on how to implement a subresource in antd tabs.
Here's a basic example of how you can use the resource
prop in the Show
and List
components:
In this example, the Show
component is used to display the "projects" resource, and the List
component is used to display the "projects-admin" resource. However, this does not reflect the URL structure you mentioned.
For more complex scenarios like the one you described, you might need to use more advanced features of Refine and Ant Design, which are not covered in the provided extracts. I recommend checking the official documentation for more information:
- Refine documentation (https://refine.dev/docs)
- Ant Design documentation (https://ant.design/docs/react/introduce)
Please note that the information provided is based on the extracts and may not fully answer your question.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@111054132537741312> kapa.ai is still learning and improving, please let us know how it did by reacting below
boiling-coffee•7mo ago
@kapa.ai What is weird is that I declared project-admins as a resource with a specific url for the list component :
list: "/projects/show/:id/project-admins"
And it still tries to get "/project-admins" instead.
Let me check the knowledge base for you. One moment! :books:
----------------------
Based on the information provided in the extracts, it seems like you're experiencing an issue where the URL for the "project-admins" resource is not being set correctly.
In Refine, the
list
property in the resources
array is used to define the route path for the resource. For example:
However, it's important to note that the list
property is used to define the route path, not the API endpoint. If your application is trying to fetch data from "/project-admins" instead of "/projects/show/:id/project-admins", it might be because the API endpoint is set incorrectly.
If you're using a custom dataProvider, you might need to adjust the logic in your dataProvider to correctly handle the "project-admins" resource.
Unfortunately, the provided extracts do not contain enough information to provide a more specific solution. I recommend checking the Refine documentation (https://refine.dev/docs) for more information on how to work with resources and dataProviders.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@111054132537741312> kapa.ai is still learning and improving, please let us know how it did by reacting below