continuing-cyan
continuing-cyan6mo ago

use multiple Data providers with

use multiple Data providers with different domain routes. Then use dataProviderName on the hooks to select the one you want. I use this often for switching from mock to proper api.
1 Reply
fascinating-indigo
fascinating-indigo6mo ago
<Refine
routerProvider={routerProvider}
dataProvider={{
default: dataProvider(apiBaseUrl, axiosInstance),
mock: dataProvider(apiMockUrl),
}}
<Refine
routerProvider={routerProvider}
dataProvider={{
default: dataProvider(apiBaseUrl, axiosInstance),
mock: dataProvider(apiMockUrl),
}}
Oh they are on the same api. I read domain as being different domain address. I don’t know the best way to solve this, but you can pass in a path like api/v2/users straight as resource name in a hook. If you want to just pass in users you would have to pass the prefix as a meta value and handle in your data provider. There might be other ways though.