nuxt-auth-utils icon indicating copy to clipboard operation
nuxt-auth-utils copied to clipboard

Mixed use of ofetch and $fetch

Open septatrix opened this issue 1 year ago • 2 comments

While reading the codebase (to potentially implement #89, most likely based on the existing Keycloak provider) I noticed that some places use ofetch and others use $fetch. Is there a specific reason for this? Otherwise it might be wise to unify them and use one of the two consistently throughout the codebase.

septatrix avatar May 16 '24 22:05 septatrix

$fetch = ofetch ref: https://nuxt.com/docs/getting-started/data-fetching#fetch

TLDR from the link;

Nuxt includes the [ofetch](https://github.com/unjs/ofetch) library, and is auto-imported as the $fetch alias globally across your application.

If this answers your questions, feel free to close the issue.

amandesai01 avatar May 22 '24 07:05 amandesai01

I knew that $fetch is at least some wrapper over ofetch. However, if there is no difference, I would reason that only one of the two should be used consistently throughout the codebase

septatrix avatar May 22 '24 09:05 septatrix

I am happy to move everything to $fetch.

Anyone happy to open a PR for this? 🙏

atinux avatar Jun 05 '24 22:06 atinux