nikus
nikus
Explore posts from servers
NNuxt
Created by nikus on 4/19/2024 in #❓・help
useFetch universal ( SSR + Client )
So currently we have a simple wrapper around useFetch to perform API calls, but since latest updates i can see a warning saying that the component is already mounted, and it makes sense, because useFetch is used to pass the data from the server to the frontend, so my question is, how do we make this "universal", so we dont have to deal with checking whenever the call is running server or client side ? I can quickly make it toggle between $fetch and useFetch since the options are similar, the problem is that the response type is not the same, this makes it really hard to have something that works both sides, what would be the best approach here?
6 replies