yodata-client-js
Advanced tools
Comparing version 0.0.4 to 0.0.8
@@ -19,3 +19,3 @@ { | ||
}, | ||
"version": "0.0.4", | ||
"version": "0.0.8", | ||
"main": "yodata.client.js", | ||
@@ -22,0 +22,0 @@ "private": false, |
@@ -1,2 +0,2 @@ | ||
(function(){ | ||
(function() { | ||
// Base object, `window` in the browser, `exports` in node. | ||
@@ -8,3 +8,3 @@ var base = this; | ||
var client = function yodataClient(options) { | ||
var client = function yodataClient(options) { | ||
this.authToken = options.authToken; | ||
@@ -27,18 +27,15 @@ this._authStateChangeHandler = undefined; | ||
headers: { 'Authorization' : 'Bearer ' + authToken }, | ||
success:function(res, textStatus, jqXHR) | ||
{ | ||
success:function(res, textStatus, jqXHR) { | ||
callback(null, res); | ||
}, | ||
error: function(res, textStatus, errorThrown) | ||
{ | ||
error: function(res, textStatus, errorThrown) { | ||
callback(res.responseJSON, null); | ||
} | ||
}); | ||
} | ||
else { | ||
} else { | ||
var options = { | ||
url: url, | ||
method: type, | ||
headers: { | ||
'Authorization' : 'Bearer ' + authToken | ||
headers: { | ||
'Authorization' : 'Bearer ' + authToken | ||
} | ||
@@ -52,3 +49,3 @@ } | ||
var request = require("request"); | ||
var request = require('request'); | ||
@@ -61,8 +58,7 @@ request(options, function(err, response, body) { | ||
callback(err, typeof body === "object" ? body : JSON.parse(body)); | ||
callback(err, typeof body === 'object' ? body : JSON.parse(body)); | ||
}); | ||
} | ||
} | ||
else { | ||
} else { | ||
callback(new Error('User is not logged in'), null); | ||
@@ -87,11 +83,9 @@ } | ||
dataType: 'json', | ||
processData: false, | ||
contentType: false, | ||
processData: false, | ||
contentType: false, | ||
headers: { 'Authorization' : 'Bearer ' + authToken }, | ||
success:function(res, textStatus, jqXHR) | ||
{ | ||
success:function(res, textStatus, jqXHR) { | ||
callback(null, res); | ||
}, | ||
error: function(res, textStatus, errorThrown) | ||
{ | ||
error: function(res, textStatus, errorThrown) { | ||
callback(res.responseJSON, null); | ||
@@ -108,3 +102,3 @@ } | ||
var request = require("request"); | ||
var request = require('request'); | ||
@@ -120,4 +114,3 @@ request(options, function(err, response, body) { | ||
} | ||
} | ||
else { | ||
} else { | ||
callback(new Error('User is not logged in'), null); | ||
@@ -240,3 +233,3 @@ } | ||
// ------------------------ | ||
client.prototype.getApiUrl = function () { | ||
client.prototype.getApiUrl = function() { | ||
return YD_API_BASE_URL; | ||
@@ -261,18 +254,13 @@ } | ||
// Export class to `window` or `exports` object | ||
if (typeof exports !== 'undefined') { | ||
if (typeof module !== 'undefined' && module.exports) { | ||
exports = module.exports = client; | ||
} | ||
exports.YDClient = client; | ||
} else { | ||
base.YDClient = client; | ||
} | ||
if (typeof define === 'function' && define.amd) { | ||
if (typeof Package !== 'undefined') { | ||
YDClient = client; | ||
} else if (typeof define === 'function' && define.amd) { | ||
define('YDClient', [], function() { | ||
return client; | ||
return client; | ||
}); | ||
} else if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = client; | ||
} else { | ||
base.YDClient = client; | ||
} | ||
}.call(this)); | ||
}.call(this)); |
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
16180
216