Skip to content

Modificar header Accept sin interceptor #276

Discussion options

You must be logged in to vote

Hey @WilianMarroquin, since this module provides a simple wrapper on top of ofetch, you can try doing something like this

const sanctumFetch = useSanctumClient()

await sanctumFetch(
  '/api/endpoint',
  {
    headers: {
      CustomHeader: 'custom-value',
    },
  },
)

However, the module may override some of the values because the header processing order might differ. Another disadvantage is that you have to repeat the same approach every time you want to pass a custom header, so interceptors can solve this more efficiently.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@WilianMarroquin
Comment options

Answer selected by manchenkoff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants