Skip to content

Commit

Permalink
fix(uve): GraphQL pages can't be edited, giving 404 #29045 (#29046)
Browse files Browse the repository at this point in the history
### 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 **
  • Loading branch information
fmontes authored Jun 28, 2024
1 parent 5d577dc commit 7b85a40
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/nextjs/src/utils/gql.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(", ")}` : "";
Expand Down Expand Up @@ -114,15 +114,15 @@ 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);

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
},
Expand Down

0 comments on commit 7b85a40

Please sign in to comment.