multiple data providers
<Refine
dataProvider={{
default: dataProvider(API_BASE_URL),
other: dataProvider(API_GHN),
}}
notificationProvider={useNotificationProvider}
i18nProvider={i18nProvider}
routerProvider={routerBindings}
resources={[
i have another dataProvider as other and tried to get it from other components by logging it, but it's always undefined
const API_URL = useApiUrl("other");
console.log(API_URL);
5 Replies
Hi @tuanna_. 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, it seems like you're trying to use a different data provider named "other" in your component. However, the
useApiUrl
hook you're using is not mentioned in the extracts, so I can't provide specific guidance on that.
In refine, you can specify which data provider to use in your components or hooks by using the dataProviderName
prop. For example, if you're using the useTable
hook or a component like Show
or Edit
, you can specify the data provider like this:
This will tell refine to use the "other" data provider for these hooks or components. If dataProviderName
is not specified, refine will use the default data provider.
If you're trying to use a different method to access the data provider, it might not be supported by refine. I recommend checking the refine documentation (https://refine.dev/docs) for more information on how to use multiple data providers.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@353701348463738885> kapa.ai is still learning and improving, please let us know how it did by reacting below
other-emerald•11mo ago
@kapa.ai what about useCustom
Let me check the knowledge base for you. One moment! :books:
----------------------
The
useCustom
hook is not mentioned in the provided extracts. However, in the context of refine, useCustom
is a hook that allows you to make custom requests to your API using your data provider.
Here's a general example of how you might use it:
In this example, useCustom
is used to make a request to a custom endpoint on the API. The fetch
function is provided by the data provider and is used to make the request. The resource
prop is used to specify the resource that the request is related to.
Please note that this is a general example and the actual usage might vary based on your data provider and API. For more specific information, you should refer to the refine documentation (https://refine.dev/docs) or the documentation of your data provider.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@353701348463738885> kapa.ai is still learning and improving, please let us know how it did by reacting below