Vueuse Usefetch
Can we do a little effort to close the I can remove all logic to encode raw objects to build the request body and also remove the content-type header handling and just keep the original logic, only adding the content type when necessary. Problems to be resolved:
|
Replies
Jun 11, 2021 Collaborator
I'm currently working on a PR for this. I've been looking at how other popular libraries have done things and am going to follow what they do. Currently following what |
Jun 11, 2021
If I might make a suggestion: it's a noble goal to try to make useFetch cover everyone's use cases, however, I think it's in the best interest of the ecosystem to make as many of the features as tree-shakeable as possible. A collection of composition-based utilities. Even the useHttp example is a bit heavy, IMHO. People should only pay for what they use. Sorry for butting my head in. This isn't my library. Just an area of interest for me. What you're working on here could well be one of the most important and most used utilities in the Vue ecosystem. The weight of the design is as important as the features, for sure. |
Jun 11, 2021
I don't mind at all and do appreciate the input. When I was mentioning doing what |
Jun 11, 2021 Maintainer
I personally would like to keep this function as simple as possible. It's more like, if you want to fetch something quickly, we already provided out-of-box. For more complex cases, they should use |
Jun 11, 2021
Since it looks like we would all like to keep |
Jun 11, 2021
Yesterday I made a PR #573 It sets the content type only if no content type is given and the payload is It handles only the case |
Jun 15, 2021
As a newcomer, I thought Also, coming from How can one use |
Jun 16, 2021
@mariusa You can see the |
Jun 16, 2021
Thanks. Let's consider the use case that one wants to process retrieved data, right after retrieval: This won't work, as data isn't set yet (?). One has to wait for fetch to complete. How should one handle this? Have continuous a loop to check if isFinished is set? (ugly) |
Jun 16, 2021 Author
In the original example, it is fetching async (is feching asap), since You can see a playground here |