@people.io/ppl-api-client-js
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -17,3 +17,3 @@ const client = require('./lib/httpClient'); | ||
async function getUserIdToken({ token, apiKey, clientId } = {} ) { | ||
return client.execute('post', 'idToken', undefined, { token, apiKey, clientId }); | ||
return client.execute('get', 'idToken', undefined, { token, apiKey, clientId }); | ||
} | ||
@@ -20,0 +20,0 @@ |
@@ -54,3 +54,3 @@ const axios = require('axios'); | ||
'X-Api-Key': `${params.apiKey}`, | ||
'X-APP-CLIENT-ID': `${params.clientId}`, | ||
'X-App-Client-Id': `${params.clientId}`, | ||
} | ||
@@ -91,2 +91,14 @@ }; | ||
// yes this is a bit of a hack: we need it to trap some | ||
// possible weird output due to wrong configs. | ||
function checkDataStatusCode(data = {}) { | ||
const status = data.statusCode || data.status || 0; | ||
if (status.toString().match((/[45]0[0-9]/))) { | ||
throw data; | ||
} | ||
return data; | ||
} | ||
function execute(method = 'get', endpointName = 'none', data = {}, options = {}) { | ||
@@ -96,3 +108,3 @@ const params = getCallParams(endpointName, options); | ||
return axios(request); | ||
return axios(request).then(({data}) => checkDataStatusCode(data)); | ||
} | ||
@@ -99,0 +111,0 @@ |
{ | ||
"name": "@people.io/ppl-api-client-js", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Simple client for people.io api", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17269
9
269