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);
K
kapa.ai185d ago
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:
useTable({
dataProviderName: "other",
});

// or

<Show dataProviderName="other">...</Show>;

// or

<Edit dataProviderName="other">...</Edit>;
useTable({
dataProviderName: "other",
});

// or

<Show dataProviderName="other">...</Show>;

// or

<Edit dataProviderName="other">...</Edit>;
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: ----------------------
K
kapa.ai185d ago
<@353701348463738885> kapa.ai is still learning and improving, please let us know how it did by reacting below
S
sharp-indigo185d ago
@kapa.ai what about useCustom
K
kapa.ai185d ago
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:
const { data, mutate, isLoading } = useCustom({
resource: "posts",
custom: ({ fetch }) => fetch(`${API_URL}/custom-endpoint`),
});
const { data, mutate, isLoading } = useCustom({
resource: "posts",
custom: ({ fetch }) => fetch(`${API_URL}/custom-endpoint`),
});
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: ----------------------
K
kapa.ai185d ago
<@353701348463738885> kapa.ai is still learning and improving, please let us know how it did by reacting below
More Posts
AutoSave UXI am using the `autoSave` feature for `useForm` and it saves fine and shows "saved ☑️ " in AutoSaveIcrmWhy changes made to a node module does not applyrefine titlei'm using the refine project sample template and still working on it, in every page route theres titHow do I upload a file with material UI?I would like to upload a file in the creation form.Using refine in monoreposHello, please tell me is it possible to run refine in monorepo? I'm getting a "refine core package ndataProvider doesn't take the pagination that passed in the hookconst { tableProps } = useTable<IColor>({ pagination: { pageSize: 5, current: 1, Disable Router Query Params?I'm upgrading to Refine v4 and the latest React Router v6 with BrowserRouter. Somehow there are new idk why my useForm edit doesnt workconst { modalProps: editModalProps, formProps: editFormProps, show: editModalShow, } =Can I get result of useCreate()?I would like to get auto generate Id that why I want to get result useCreate() mutation. but I can gWhy useDelete calls getIdentity from auth-provider?Hey there. I'm facing a wired problem. I have a table that has an `actions` column with a delete butProduction build giving errorHello, I'm trying to host a refine app in AWS EC2. Did "npm run build" after setting 'outDir' to 'Ant Design Light Mode with Dark Header and Sider?I have my Refine App wrapped in a ColorModeContextProvider, which works great, but I want the HeaderHow do you change the project name?On the side bar, it says "refine Project" I've searched the entire codebase and couldn't find anythiNamed routesHi, does Refine.dev support named routes? e.g. if I create a custom route, not related to any resopm2 for productionhello, how to use pm2 for making a refine.dev app going live ? I got this error using a file calledApp 'flashes' dark mode before setting to light modeHi! For some reason, on load, my app starts off as dark mode before flashing back to light mode. H