Skip to content

SSR: Change graphql headers in dynamic routes nextjs #1237

Answered by JoviDeCroock
rohanrajpal asked this question in Q&A
Discussion options

You must be logged in to vote

In your [store-name].tsx

function Component() {
  const router = useRouter()
  useQuery({
    query: YOUR_QUERY,
    context: React.useMemo(function () { return { url: `example.com/graphql?token=${router.query['store-name']}` } }, []) 
  })
}

Replies: 1 comment 19 replies

Comment options

You must be logged in to vote
19 replies
@JoviDeCroock
Comment options

@JoviDeCroock
Comment options

@rohanrajpal
Comment options

@JoviDeCroock
Comment options

@rohanrajpal
Comment options

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