nuxt-auth-sanctum
nuxt-auth-sanctum copied to clipboard
[Feature] Explicit types for fetch client
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
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>
Using
useSanctumFetchI 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.