@digilabs/ngest-ig
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -121,2 +121,7 @@ 'use strict' | ||
if (passed_headers && passed_headers.version){ | ||
headers['VERSION'] = passed_headers.version | ||
} | ||
console.log('headers set', headers) | ||
return this.httpHeaders = headers; | ||
@@ -134,12 +139,8 @@ } | ||
// this.config_env.api.CST = response.headers.cst; | ||
// this.config_env.api.XSecurityToken = response.headers['x-security-token']; | ||
this.config_env.api.oauth = response.data.oauthToken; | ||
this.config_env.accountId = response.data.accountId; | ||
this.config_env.clientId = response.data.clientId; | ||
// console.log(response) | ||
if (!response.data.oauthToken) { | ||
return Promise.reject('Login tokens not present') | ||
} | ||
// console.log('Successful : Login + tokens collected'); | ||
@@ -176,9 +177,6 @@ return Promise.resolve() | ||
baseURL: this.base, | ||
url: url | ||
url: url, | ||
headers: (this.httpHeaders) ? this.httpHeaders : this.setHttpAuthHeaders() | ||
} | ||
if (ispublic === false) { | ||
options.headers = (this.httpAuthHeaders) ? this.httpAuthHeaders : this.setHttpAuthHeaders() | ||
} | ||
if (typeof responseType !== 'undefined') { | ||
@@ -188,11 +186,12 @@ options.responseType = responseType; | ||
// console.log('for getting prices', options) | ||
return axios(options) | ||
.then(res => { | ||
// console.log('results from reques', res) | ||
return Promise.resolve(res.data) | ||
}) | ||
.catch(err => { | ||
return Promise.reject('/there was an errors') | ||
return Promise.reject({ | ||
status:err.response.status, | ||
statusText: err.response.statusText, | ||
method: 'ClientAuthenticated::getData' | ||
}) | ||
}) | ||
@@ -199,0 +198,0 @@ } |
{ | ||
"name": "@digilabs/ngest-ig", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "IG API nodejs client", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
41149