Diizzayy / nuxt-graphql-client

⚡️ Minimal GraphQL Client + Code Generation for Nuxt3
https://nuxt-graphql-client.web.app
MIT License
341 stars 42 forks source link

Passing Headers in Gql Functions #386

Open danwritecode opened 9 months ago

danwritecode commented 9 months ago

Environment

Describe the bug

There is seemingly no way to pass headers to Gql Functions: https://nuxt-graphql-client.web.app/getting-started/gql-functions

This is an issue because if I want to use a Gql Function in a server route, the Token is no longer included in the request. I would like to be able to just extract the token from the event headers and pass it manually into the function so I can use the Gql Function server side.

Expected behaviour

To be able to pass an options object or something like that where I can specify headers.

Reproduction

No response

Additional context

No response

Logs

No response

tasiotas commented 9 months ago

what about passing headers with this composable? https://nuxt-graphql-client.web.app/getting-started/composables#usegqlheaders


useGqlHeaders({ 'X-Custom-Header': 'value' })```
iBobik commented 5 months ago

It seems like a duplicate of #328.

iBobik commented 5 months ago

what about passing headers with this composable? https://nuxt-graphql-client.web.app/getting-started/composables#usegqlheaders

useGqlHeaders({ 'X-Custom-Header': 'value' })```

Sometimes I do not want to set token/header for all subsequent requests.