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 |
Beta Was this translation helpful? Give feedback.
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>'); |
Beta Was this translation helpful? Give feedback.
@ahiyalala Hello! The
sitecoreEdgeContextId
should be passed as a query string parameter in the request to the Edge endpoint. TheapiKey
property should only be used when working with a local Sitecore instance or Sitecore XP.Out of the box, the
sitecore-jss
package 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: