Fetch instead of axios
Heya, quick question - is it possible to provide the dataProvider with fetch instance rather than axios instance? (from how it looks it seems not, but wanted to confirm)
5 Replies
Hi @YechiamTK. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Yes, it is possible to use
fetch
instead of axios
when creating a custom data provider in refine. In the provided extracts, there is an example of using fetch
for error handling in a custom data provider:
Source: https://refine.dev/docs/api-reference/core/providers/data-provider (https://refine.dev/docs/api-reference/core/providers/data-provider)
You can replace axios
with fetch
and modify the custom data provider accordingly to suit your needs.
----------------------
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.
<@239743886581301248> kapa.ai is still learning and improving, please let us how it did by reacting below
wise-white•17mo ago
Hey @YechiamTK, there’s no built in support but it should be fairly easy to achieve by swizzling simple rest data provider 🙏
like-gold•17mo ago
Oh simple rest provider is swizz-able? Awesome