rest-client-sdk
Advanced tools
Comparing version 0.6.0 to 0.7.0
@@ -20,17 +20,22 @@ Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}var ACCESS_TOKEN_KEY='rest_client_sdk.api.access_token';var | ||
{var _this=this; | ||
if(!this._hasATokenBeenGenerated&&!this._tokenGenerator.canAutogenerateToken){ | ||
return this._asyncStorage.getItem(ACCESS_TOKEN_KEY). | ||
then(function(token){ | ||
if(!token){ | ||
if(!_this._hasATokenBeenGenerated&&!_this._tokenGenerator.canAutogenerateToken){ | ||
throw new Error('No token has been generated yet.');} | ||
if(!this._hasATokenBeenGenerated&&this._tokenGenerator.canAutogenerateToken){ | ||
return this._tokenGenerator.generateToken(). | ||
if(!_this._hasATokenBeenGenerated&&_this._tokenGenerator.canAutogenerateToken){ | ||
return _this._tokenGenerator.generateToken(). | ||
then(function(){return _this._asyncStorage.getItem(ACCESS_TOKEN_KEY);}). | ||
then(function(token){return token&&JSON.parse(token).access_token;});} | ||
then(function(generatedToken){return generatedToken&&JSON.parse(generatedToken).access_token;});}} | ||
return this._asyncStorage.getItem(ACCESS_TOKEN_KEY). | ||
then(function(token){return token&&JSON.parse(token).access_token;});}},{key:'logout',value:function logout() | ||
return token&&JSON.parse(token).access_token;});}},{key:'logout',value:function logout() | ||
{ | ||
@@ -37,0 +42,0 @@ return this._asyncStorage.removeItem(ACCESS_TOKEN_KEY);}},{key:'generateToken',value:function generateToken( |
{ | ||
"name": "rest-client-sdk", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "Rest Client SDK for API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
38784
427