Skip to content

Commit

Permalink
#21 add default serviceURL (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
easingthemes committed Jun 2, 2021
1 parent 5cc7ec3 commit ec334ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ class AEMHeadless {
*/
constructor (config) {
let endpoint = AEM_GRAPHQL_ACTIONS.endpoint
let serviceURL = config
if (typeof config !== 'string') {
let serviceURL = AEM_GRAPHQL_ACTIONS.serviceURL

if (typeof config === 'string') {
serviceURL = config
} else {
serviceURL = config.serviceURL || serviceURL
endpoint = config.endpoint || endpoint
this.auth = config.auth
Expand Down Expand Up @@ -249,7 +252,6 @@ class AEMHeadless {
* @returns void
*/
__validateUrl (url) {
console.log('URLZ', url)
if (!url) {
throw new SDKError('InvalidParameter', 'SDKError', '', 'Required param missing: endpoint')
}
Expand Down
3 changes: 2 additions & 1 deletion src/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ const AEM_GRAPHQL_ACTIONS = {
persist: 'graphql/persist.json',
execute: 'graphql/execute.json',
list: 'graphql/list.json',
endpoint: 'content/graphql/global/endpoint.json'
endpoint: 'content/graphql/global/endpoint.json',
serviceURL: '/'
}

module.exports = {
Expand Down

0 comments on commit ec334ab

Please sign in to comment.