vueuse icon indicating copy to clipboard operation
vueuse copied to clipboard

Add the defaultWindow variable in order to be able to send fetch requests in an SSR mode

Open proc07 opened this issue 1 year ago • 1 comments

To be able to run a set of code on both the client and server side

proc07 avatar Sep 27 '24 12:09 proc07

@antfu in SSR mode, the component called useFetch, but the fetch function could not be called on the server side, resulting in the request failure. Is it possible to increase the line of code. 截屏2024-09-27 21 00 45

proc07 avatar Sep 27 '24 13:09 proc07

Thanks, but window is designed to be undefined on the server side. Instead in useFetch we could try to detect from globalThis.fetch. I am closing this PR - feel free to bring up another approach in another PR.

antfu avatar Oct 24 '24 16:10 antfu