Hi there,
I'm using fetch to get my content as follow :
async function fetchData() {
const endpoint = process.env.NEXT_PUBLIC_PRISMIC_ENDPOINT;
const token = process.env.NEXT_PUBLIC_PRISMIC_ACCESS_TOKEN;
const query = `
query ExperimentDocumentQuery {
allExperiments{
edges {
node {
seo_title
seo_description
hero_headline
usage_headline
usage_p_1
usage_p_2
usage_p_3
usage_p_4
twist_title
twist_image_hero
twist_p_1
twist_p_2
twist_p_3
twist_image_row_1
twist_image_row_2
twist_image_row_3
twist_image_row_4
twist_image_bottom
footer_big_idea
}
}
}
}
`;
const response = await fetch(endpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({ query }),
});
const data = await response.json();
}
And then I get this CORS error:
Access to fetch at 'https://myrepo.cdn.prismic.io/graphql' from origin 'http://localhost:3000' has been blocked by CORS policy: Request header field access-control-allow-origin is not allowed by Access-Control-Allow-Headers in preflight response.
Any idea?
Thanks for your help!