How to use Edge Context ID in front-end? #2044
DescriptionCurrently, we are using a GraphQL Client: where the What's the correct approach to use Additional informationNo response |
Replies: 1 comment
|
@ahiyalala Hello! The Out of the box, the We'll consider adding this topic in our documentation Here’s an example of how to use it with Next.js: import { GraphQLRequestClient, getEdgeProxyContentUrl } from '@sitecore-jss/sitecore-jss-nextjs/graphql';
const client = new GraphQLRequestClient(getEdgeProxyContentUrl('<your-context-id>'));
client.request('<your-query>'); |
@ahiyalala Hello! The
sitecoreEdgeContextIdshould be passed as a query string parameter in the request to the Edge endpoint. TheapiKeyproperty should only be used when working with a local Sitecore instance or Sitecore XP.Out of the box, the
sitecore-jsspackage provides getEdgeProxyContentUrl, which you can use to construct an endpoint URL.We'll consider adding this topic in our documentation
Here’s an example of how to use it with Next.js: