multiple different list/create/edit/view API endpoints for the same REST entity
What is the recommended implementation way/hack strategy when I have resources that have several different list/create/edit/view API endpoints (with different API request and response types)? In one ResourceComponent I can only add one list/create/edit/show entry of the same kind. Should I add multiple ResourceComponent when I have multiple but different operation of the same kind?
7 Replies
Hi @attilanyers. 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. However, you can refer to the refine documentation for more information on handling resources and customizing their behavior:
- Refine Config - Resources (https://refine.dev/docs/api-reference/core/components/refine-config/#resources)
- Data Provider (https://refine.dev/docs/api-reference/core/providers/data-provider)
These resources might help you find a suitable solution for your specific use case.
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------Data Provider | refine
The data provider acts as a data layer for your app that makes the HTTP requests and encapsulates how the data is retrieved. refine consumes these methods via data hooks.
| refine
`` component is the entry point of a refine app. It is where the highest level of configuration of the app occurs.
<@1102653264283054151> kapa.ai is still learning and improving, please let us how it did by reacting below
raw-harlequin•17mo ago
I did not understand what you mean. Do you want to perform CRUD operations on different resources on the same screen? You can give
resource
prop to hooks for this.metropolitan-bronze•17mo ago
I mean let's say I have an entity called User on backend side. I have multiple different list/create/update APIs for this entity (for example 3 list and 2 update API endpoints). I want to have different UI components for each operation. I want to come up with a general solution that we can use in our future projects.
My current idea is to create one resource object for each API and fill one of its fields (list/show/create/edit)
and use custom navigation in my components (using useGo hook)
@yildirayunlu
And in case I can assign a default edit/show operation for a list operation, then I can fill the corresponding field in the resource obj
raw-harlequin•17mo ago
Hey @attilanyers
We cannot set a default list page yet. However, the
resource
prop can be used for this. Like this:
product/list: resource
: "product",
product/active: resource
: "product/active",
product/inactive: resource
: "product/inactive",metropolitan-bronze•17mo ago
Yes, that's what I did, thanks