-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Chore] Removed deprecated props, updated samples to use clientFactory (
#1784) * [Chore] Removed deprecated props, updated samples to use clientFactory (#1783) * Updated Angular sample and exposed GraphQLRequestClient * Upgraded React app, removed deprecated defaultProps property * Updated node-headless-ssr-experience-edge and vue samples * Updated comments * Updated CHANGELOG * Updated CHANGELOG
- Loading branch information
1 parent
ab836ca
commit a41c8bb
Showing
23 changed files
with
146 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/create-sitecore-jss/src/templates/angular/src/app/lib/client-factory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { | ||
GraphQLRequestClientFactoryConfig, | ||
GraphQLRequestClient, | ||
} from '@sitecore-jss/sitecore-jss-angular'; | ||
import { environment as env } from '../../environments/environment'; | ||
|
||
// The GraphQLRequestClientFactory serves as the central hub for executing GraphQL requests within the application | ||
|
||
/** | ||
* Creates a new GraphQLRequestClientFactory instance | ||
* @returns GraphQLRequestClientFactory instance | ||
*/ | ||
export const createGraphQLClientFactory = () => { | ||
let clientConfig: GraphQLRequestClientFactoryConfig; | ||
|
||
if (env.graphQLEndpoint && env.sitecoreApiKey) { | ||
clientConfig = { | ||
endpoint: env.graphQLEndpoint, | ||
apiKey: env.sitecoreApiKey, | ||
}; | ||
} else { | ||
throw new Error('Please configure your graphQLEndpoint and sitecoreApiKey.'); | ||
} | ||
|
||
return GraphQLRequestClient.createClientFactory(clientConfig); | ||
}; | ||
|
||
export const clientFactory = createGraphQLClientFactory(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...create-sitecore-jss/src/templates/node-headless-ssr-experience-edge/src/client-factory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { | ||
GraphQLRequestClientFactoryConfig, | ||
GraphQLRequestClient, | ||
} from '@sitecore-jss/sitecore-jss'; | ||
import { config } from './config'; | ||
|
||
// The GraphQLRequestClientFactory serves as the central hub for executing GraphQL requests within the application | ||
|
||
/** | ||
* Creates a new GraphQLRequestClientFactory instance | ||
* @returns GraphQLRequestClientFactory instance | ||
*/ | ||
export const createGraphQLClientFactory = () => { | ||
let clientConfig: GraphQLRequestClientFactoryConfig; | ||
|
||
if (config.endpoint && config.apiKey) { | ||
clientConfig = { | ||
endpoint: config.endpoint, | ||
apiKey: config.apiKey, | ||
}; | ||
} else { | ||
throw new Error('Please configure your endpoint and apiKey.'); | ||
} | ||
|
||
return GraphQLRequestClient.createClientFactory(clientConfig); | ||
}; | ||
|
||
export const clientFactory = createGraphQLClientFactory(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/create-sitecore-jss/src/templates/react/src/lib/client-factory.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { GraphQLRequestClient } from '@sitecore-jss/sitecore-jss-react'; | ||
import config from '../temp/config'; | ||
|
||
// The GraphQLRequestClientFactory serves as the central hub for executing GraphQL requests within the application | ||
|
||
/** | ||
* Creates a new GraphQLRequestClientFactory instance | ||
* @returns GraphQLRequestClientFactory instance | ||
*/ | ||
export const createGraphQLClientFactory = () => { | ||
let clientConfig; | ||
|
||
if (config.graphQLEndpoint && config.sitecoreApiKey) { | ||
clientConfig = { | ||
endpoint: config.graphQLEndpoint, | ||
apiKey: config.sitecoreApiKey, | ||
}; | ||
} else { | ||
throw new Error('Please configure your graphQLEndpoint and sitecoreApiKey.'); | ||
} | ||
|
||
return GraphQLRequestClient.createClientFactory(clientConfig); | ||
}; | ||
|
||
export const clientFactory = createGraphQLClientFactory(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/create-sitecore-jss/src/templates/vue/src/lib/client-factory.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { GraphQLRequestClient } from '@sitecore-jss/sitecore-jss-vue'; | ||
import config from '../temp/config'; | ||
|
||
// The GraphQLRequestClientFactory serves as the central hub for executing GraphQL requests within the application | ||
|
||
/** | ||
* Creates a new GraphQLRequestClientFactory instance | ||
* @returns GraphQLRequestClientFactory instance | ||
*/ | ||
export const createGraphQLClientFactory = () => { | ||
let clientConfig; | ||
|
||
if (config.graphQLEndpoint && config.sitecoreApiKey) { | ||
clientConfig = { | ||
endpoint: config.graphQLEndpoint, | ||
apiKey: config.sitecoreApiKey, | ||
}; | ||
} else { | ||
throw new Error('Please configure your graphQLEndpoint and sitecoreApiKey.'); | ||
} | ||
|
||
return GraphQLRequestClient.createClientFactory(clientConfig); | ||
}; | ||
|
||
export const clientFactory = createGraphQLClientFactory(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/create-sitecore-jss/src/templates/vue/src/lib/layout-service-factory.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.