vueuse / vueuse

Collection of essential Vue Composition Utilities for Vue 2 and 3

Home Page:https://vueuse.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[useFetch] Method execute should accept a config argument - same as useAxios

wouterkroes opened this issue · comments

Clear and concise description of the problem

As a developer using VueUse, the useFetch's method execute should accept a config argument. This will eliminate the need to resort to useAxios. Currently, I opt for useAxios because its execute method supports this config argument.

I prefer leveraging useFetch over useAxios due to several key benefits:

  • No need to install the Axios dependency separately.
  • Smaller distribution package, as Axios has known tree-shaking issues (see axios/axios#5598 and axios/axios#5380).

I'd like to contribute a PR for this feature request, but I'd appreciate the opportunity to collaborate and coordinate with someone beforehand.

Suggested solution

compare useFetch execute (https://github.com/vueuse/vueuse/blob/main/packages/core/useFetch/index.ts) with useAxios execute (https://github.com/vueuse/vueuse/blob/main/packages/integrations/useAxios/index.ts) and add the actual implementation

Alternative

if adding a config argument to useFetch method execute is not desired/possible, keep using useAxios is a fine alternative for me.

Additional context

No response

Validations