Skip to content

[Feature] Explicit types for fetch client #358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
manchenkoff opened this issue Apr 11, 2025 · 2 comments · May be fixed by #359
Open

[Feature] Explicit types for fetch client #358

manchenkoff opened this issue Apr 11, 2025 · 2 comments · May be fixed by #359
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@manchenkoff
Copy link
Owner

Is your feature request related to a problem? Please describe.

Since we do not provide a full ofetch-compatible client, we should explicitly return an instance that can be configured only with supported fields.

For example, the following list of fields should not be overridden by the user to keep sanctum-related logic as is:

  • baseUrl
  • credentials
  • redirect
  • retry
  • onRequest
  • onRequestError
  • onResponse
  • onResponseError
@manchenkoff manchenkoff added the enhancement New feature or request label Apr 11, 2025
@manchenkoff manchenkoff self-assigned this Apr 11, 2025
@manchenkoff manchenkoff linked a pull request Apr 11, 2025 that will close this issue
@manchenkoff manchenkoff added this to the 0.7.0 milestone Apr 11, 2025
@projct1
Copy link

projct1 commented Apr 24, 2025

A bit off topic, but could you please tell me how I can use nuxt useFetch while still having all the functionality of useSanctumFetch (so that cookies etc. are automatically passed to the request)?
Using useSanctumFetch I can't do something like this:

<script setup>
    const { status, data } = useFetch('api/some-api-url')
</script>

<template>
    <div v-if="status === 'pending'">Loading...</div>
</template>

@manchenkoff
Copy link
Owner Author

Using useSanctumFetch I can't do something like this

Not sure that I get it right, but it should be possible with useSanctumFetch, please check the docs here. It exposes the same data as useAsyncData.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants