#useFetch no request found in browser network

4 messages · Page 1 of 1 (latest)

modest barn
#

I have used useFetch to get data, (composables/api.ts)ts export const reportAPI = { reports: { getItems() { return useFetch( "https://reqres.in/api/products/3", {method : 'get'} ); }, }, };

(app.vue)

  console.log(data);
});</script>``` 

In the console, I am able to print the response, but the request is not present in the network tab
tepid smelt
#

This is likely because the request happens on the server-side the first time and it's getting passed to the client then.

You can test this by implementing a button that does a second request when you click it. Then you will see it in the network tab

#

If you only want to ever call your api on the client, use a client-only component, or check for if (process.client) before calling useFetch

modest barn
#

thanks @tepid smelt this really helps