Skip to content

Commit

Permalink
Fix update-graphql-fragment-data react sample
Browse files Browse the repository at this point in the history
  • Loading branch information
CobyPear committed Sep 8, 2021
1 parent 7833ad7 commit 467600f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion samples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"build:client:rendering-host": "cross-env-shell PUBLIC_URL=$npm_package_config_tunnelUrl \"react-scripts build\"",
"build:server": "cross-env-shell NODE_ENV=production \"webpack --config server/server.webpack.config.js\"",
"bootstrap": "node scripts/bootstrap.js",
"graphql:update": "node -r babel-register ./scripts/update-graphql-fragment-data.js",
"graphql:update": "node -r @babel/register ./scripts/update-graphql-fragment-data.js",
"test": "react-scripts test --env=jsdom",
"lint": "eslint ./src/**/*.js ./sitecore/definitions/**/*.js ./scripts/**/*.js ./server/**/*.js ./data/**/*.yml",
"eject": "react-scripts eject",
Expand Down
10 changes: 5 additions & 5 deletions samples/react/scripts/update-graphql-fragment-data.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable no-console, no-underscore-dangle */

import fetch from 'cross-fetch';
import fs from 'fs';
import generateConfig from './generate-config';
const fetch = require('cross-fetch');
const fs = require('fs');
const generateConfig = require('./generate-config');

// Apollo Client supports caching GraphQL responses, which can greatly reduce network traffic needs.
// In order to work correctly with interfaces in GraphQL, it needs to know some basic information about
Expand All @@ -17,7 +17,7 @@ let jssConfig;

try {
// eslint-disable-next-line global-require
jssConfig = require('../src/temp/config').default;
jssConfig = require('../src/temp/config');
} catch (e) {
console.error(
'Unable to require JSS config. Ensure `jss setup` has been run, and the app has been started at least once after setup.'
Expand All @@ -30,7 +30,7 @@ console.log(`Updating GraphQL fragment type data from ${jssConfig.graphQLEndpoin

fetch(jssConfig.graphQLEndpoint, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
headers: { 'Content-Type': 'application/json', sc_apikey: jssConfig.sitecoreApiKey },
body: JSON.stringify({
query: `
{
Expand Down

0 comments on commit 467600f

Please sign in to comment.