You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our project we are using a custom fetch instance as described in the nuxt docu: https://nuxt.com/docs/guide/recipes/custom-usefetch
We provide the custom fetch instance as $fetchApi to the nuxt context. In particular we are setting the baseUrl on the fetch instance as well as headers.
It now looks like this setup is working for SSR, but for client side rendering the custom fetch instance seems to be ignored as the baseUrl is not respected.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
In our project we are using a custom fetch instance as described in the nuxt docu: https://nuxt.com/docs/guide/recipes/custom-usefetch
We provide the custom fetch instance as $fetchApi to the nuxt context. In particular we are setting the baseUrl on the fetch instance as well as headers.
Following the custom client configuration as explained here: https://nuxt-open-fetch.vercel.app/advanced/custom-client I now wanted to provide that custom fetch instance to nuxt-open-fetch like:
It now looks like this setup is working for SSR, but for client side rendering the custom fetch instance seems to be ignored as the baseUrl is not respected.
Looking at the implementation of createOpenFetch ( https://github.com/enkot/nuxt-open-fetch/blob/44ed19c1e6f31ec806915fa46ec45db325f35b74/src/runtime/fetch.ts#L55 ) this seems to be intentional as the custom fetch instance is only respected on the server side.
Is the approach presented above wrong? Is there a different way to incorporate the custom fetch instance on the client side?
Beta Was this translation helpful? Give feedback.
All reactions