Skip to content

Commit a07a67f

Browse files
authored
Merge pull request #32 from contentstack/automation
Stack instance issue resolved
2 parents 5ed23f2 + dbf065c commit a07a67f

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "contentstack",
3-
"version": "3.9.1",
3+
"version": "3.9.2",
44
"description": "Contentstack Javascript SDK",
55
"homepage": "https://www.contentstack.com/",
66
"author": {
@@ -9,7 +9,7 @@
99
},
1010
"main": "dist/node/contentstack.js",
1111
"browser": "dist/web/contentstack.js",
12-
"_id": "[email protected].1",
12+
"_id": "[email protected].2",
1313
"scripts": {
1414
"test": "tape test/index.js | tap-html --out ./tap-html.html",
1515
"automate": "node test.js",
@@ -44,14 +44,14 @@
4444
],
4545
"dist": {
4646
"shasum": "a328ed07240476a26b31a23261355dc929e1da63",
47-
"tarball": "https://registry.npmjs.org/contentstack/-/contentstack-3.9.1.tgz"
47+
"tarball": "https://registry.npmjs.org/contentstack/-/contentstack-3.9.2.tgz"
4848
},
4949
"license": "MIT",
5050
"directories": {},
51-
"_resolved": "https://registry.npmjs.org/contentstack/-/contentstack-3.9.1.tgz",
51+
"_resolved": "https://registry.npmjs.org/contentstack/-/contentstack-3.9.2.tgz",
5252
"_npmOperationalInternal": {
5353
"host": "packages-18-east.internal.npmjs.com",
54-
"tmp": "tmp/contentstack-3.9.1.tgz_1477830884275_0.9869455888401717"
54+
"tmp": "tmp/contentstack-3.9.2.tgz_1477830884275_0.9869455888401717"
5555
},
5656
"devDependencies": {
5757
"babel-core": "6.26.0",

src/core/stack.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ export default class Stack {
5050
this.config = config;
5151
this.cachePolicy = CacheProvider.policies.IGNORE_CACHE;
5252
this.provider = CacheProvider.providers('localstorage');
53-
console.error(stack_arguments.length);
5453

5554
switch (stack_arguments.length) {
5655
case 1:
@@ -82,39 +81,39 @@ export default class Stack {
8281
access_token: stack_arguments[1]
8382
};
8483
this.environment = stack_arguments[2];
85-
return this;
8684
} else {
8785
console.error("Kindly provide valid string parameters.");
8886
}
89-
if (stack_arguments[3]) {
87+
if (stack_arguments[3]) {
9088
if(typeof stack_arguments[3] === "string" && stack_arguments[3].region !== "us" && stack_arguments[3].region === "eu") {
91-
config['host'] = stack_arguments[0].region+"-"+"cdn.contentstack.com";
89+
config['host'] = stack_arguments[3]+"-"+"cdn.contentstack.com";
9290
} else if (typeof stack_arguments[3] === 'object') {
9391
this.fetchOptions = stack_arguments[3]
9492
}
9593
}
94+
return this;
9695
case 5:
9796
if (typeof stack_arguments[0] === "string" && typeof stack_arguments[1] === "string" && typeof stack_arguments[2] === "string") {
9897
this.headers = {
9998
api_key: stack_arguments[0],
10099
access_token: stack_arguments[1]
101100
};
102101
this.environment = stack_arguments[2];
103-
return this;
104102
} else {
105103
console.error("Kindly provide valid string parameters.");
106104
}
105+
107106
if (stack_arguments[3]) {
108-
if(typeof stack_arguments[3] === "string" && stack_arguments[3].region !== "us" && stack_arguments[3].region === "eu") {
109-
config['host'] = stack_arguments[0].region+"-"+"cdn.contentstack.com";
107+
if(typeof stack_arguments[3] === "string" && stack_arguments[3].region !== "us") {
108+
config['host'] = stack_arguments[3]+"-"+"cdn.contentstack.com";
110109
} else if (typeof stack_arguments[3] === 'object') {
111110
this.fetchOptions = stack_arguments[3]
112111
}
113112
}
114113
if (stack_arguments[4] && typeof stack_arguments[4] === 'object') {
115-
this.fetchOptions = stack_arguments[3]
114+
this.fetchOptions = stack_arguments[4]
116115
}
117-
116+
return this;
118117
default:
119118
console.error("Kindly provide valid parameters to initialize the Contentstack javascript-SDK Stack.");
120119
}

0 commit comments

Comments
 (0)