Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preview mode #43

Open
caesarsol opened this issue Dec 16, 2022 · 3 comments
Open

Preview mode #43

caesarsol opened this issue Dec 16, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@caesarsol
Copy link

Hi, pardon me in advance if it's obvious, but I haven't found the answer anywhere.

is it possible to use this library with Prismic preview mode?

I'm particularly unclear on how to apply this step in particular in the Prismic documentation.

Thanks!

@caesarsol caesarsol added the enhancement New feature or request label Dec 16, 2022
@JoiGud
Copy link

JoiGud commented Jan 26, 2023

Also looking for a solution 😅

@sarahkirby
Copy link

Hi @caesarsol & @JoiGud,

I came across this thread and thought I might be able to help.
I'm using Prismic with GraphQL & NextJS.

To setup previews follow the documentation you linked above, then you'll need to pass the previewData.ref value to your query.

export const getStaticProps = async ({ previewData }) => {
  const context = {
    headers: {
      'Prismic-Ref': previewData.ref,
    },
  };

  const { data } = await client.query({
    query: QUERY_HOME_PAGE,
    context,
  });
...

I hope this helps 🙂

@JoiGud
Copy link

JoiGud commented Jan 27, 2023

Thanks! I'm doing exactly that. Just need to finish the redirect part from your-site/preview/* to the proper URL, with the previewRef set in the queries.

It's addressed in this PR https:/prismicio/apollo-link-prismic/pull/5/files 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants