From 7b85a4055f8663cba7f358503ade749630ec8275 Mon Sep 17 00:00:00 2001 From: Freddy Montes <751424+fmontes@users.noreply.github.com> Date: Fri, 28 Jun 2024 14:09:47 -0600 Subject: [PATCH] fix(uve): GraphQL pages can't be edited, giving 404 #29045 (#29046) ### Proposed Changes * Fix #29045 ### Checklist - [ ] Tests - [ ] Translations - [ ] Security Implications Contemplated (add notes if applicable) ### Additional Info ** any additional useful context or info ** ### Screenshots Original | Updated :-------------------------:|:-------------------------: ** original screenshot ** | ** updated screenshot ** --- examples/nextjs/src/utils/gql.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/nextjs/src/utils/gql.js b/examples/nextjs/src/utils/gql.js index 3950d6f90530..d4ff65d096b5 100644 --- a/examples/nextjs/src/utils/gql.js +++ b/examples/nextjs/src/utils/gql.js @@ -4,17 +4,17 @@ const API_URL = `${process.env.NEXT_PUBLIC_DOTCMS_HOST}/api/v1/graphql`; * Get the GraphQL query for a page * * @param {*} query - * @return {*} + * @return {*} */ const getGraphQLPageQuery = ({ path, language_id, mode}) => { const params = []; if(language_id) { - params.push(`languageId: "${language_id}"`); + params.push(`languageId: "${language_id}"`); } if(mode) { - params.push(`pageMode: "${mode}"`); + params.push(`pageMode: "${mode}"`); } const paramsString = params.length ? `, ${params.join(", ")}` : ""; @@ -114,7 +114,7 @@ const getGraphQLPageQuery = ({ path, language_id, mode}) => { * Fetch content from dotCMS using GraphQL * * @param {*} query - * @return {*} + * @return {*} */ export const getGraphQLPageData = async (params) => { const query = getGraphQLPageQuery(params); @@ -122,7 +122,7 @@ export const getGraphQLPageData = async (params) => { const res = await fetch(API_URL, { method: "POST", headers: { - 'Authorization': `Bearer ${process.env.DOTCMS_AUTH_TOKEN}`, + "Cookie": `access_token=${process.env.NEXT_PUBLIC_DOTCMS_AUTH_TOKEN}`, "Content-Type": "application/json", "dotcachettl": "0" // Bypasses GraphQL cache },