nuxt-graphql-client icon indicating copy to clipboard operation
nuxt-graphql-client copied to clipboard

Send query params along with the host defined in runtimeConfig?

Open ariviom opened this issue 3 years ago • 4 comments

I'm working on a headless Craft CMS site and need to send api requests with a dynamically generated query parameter to get live previews of content. Is it possible to send query parameters along with the GraphQL request?

ariviom avatar Jul 13 '22 18:07 ariviom

@ariviom

query Sites ($name:String!) { sites ( where: { name: { equals: $name } } ) { name isActive pages { name } } }

yalondpsi avatar Jul 14 '22 15:07 yalondpsi

@Diizzayy any Idea here. It's a thing whats related to CraftCMS and Livepreviews. When Live Previews are used we need to add a token to the API URL like this:

const api = preview && token ? `${apiUrl}?token=${token}` : apiUrl

And the token is dynamically created.

Hope there is solution for this.

davidhellmann avatar Jul 30 '22 16:07 davidhellmann

@davidhellmann @ariviom Thank you for raising this point, and it's importance.

I'm going to familiarize myself with the requisites for CraftCMS's live preview and determine the best way to provide a proper solution here. I'll keep you updated accordingly.

Diizzayy avatar Jul 30 '22 18:07 Diizzayy

I want to use this package, but what's stopping me is that I still haven't found a solution to change the URL or part of it at runtime.

My problem is a little different from this one. I need to change the organization:

/v1/ORGANIZATION_1/graphql /v1/ORGANIZATION_2/graphql

In my case the organization is based on the URL.

emtudo avatar Sep 09 '22 11:09 emtudo