nuxt-modules / apollo

Nuxt.js module to use Vue-Apollo. The Apollo integration for GraphQL.
https://apollo.nuxtjs.org
MIT License
929 stars 194 forks source link

Add ability to dynamically add a query string parameter to graphql endpoint at runtime #540

Open martinszeltins opened 10 months ago

martinszeltins commented 10 months ago

Your use case

I would like to be able to add a query parameter to my graphql endpoint when I perform a graphql query. For example when I query for users, I would like to append .../graphql?api=getUsers and when I save a user, I would like to add .../graphql?api=saveUser so that when I look at the network requests, I would like to:

Instead of seeing this:

/graphql
/graphql
/graphql

I would like to see this:

/graphql?api=getUsers
/graphql?api=saveUser
/graphql?api=loadSettings

The solution you'd like

Ideally, it would be nice to update the graphql endpoint when I perform a query like at this time:

// set endpoint to /graphql?api=getUsers
result.value = await useLazyAsyncQuery(query)

Possible alternatives

No response

Additional information

No response