akio-browser
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -148,7 +148,8 @@ "use strict"; | ||
// Re-initializing the SDK should re-set it up. | ||
this.setUp(config); | ||
this.setUp(config); // If this SDK has been init'd before, it will have a stored sessionId. | ||
sessionId = this.sessionId; | ||
this.token = token; | ||
if (sessionId) { | ||
if (token) { | ||
_context.next = 6; | ||
@@ -158,15 +159,7 @@ break; | ||
return _context.abrupt("return", this.logger.error("Error initializing Akio SDK.")); | ||
return _context.abrupt("return", this.logger.error("'init' missing required parameter 'token'.")); | ||
case 6: | ||
if (token) { | ||
_context.next = 8; | ||
break; | ||
} | ||
return _context.abrupt("return", this.logger.error("'init' missing required parameter 'token'.")); | ||
case 8: | ||
this.logger.verbose("'init' with token: ".concat(token, ".")); | ||
_context.next = 11; | ||
_context.next = 9; | ||
return this.post({ | ||
@@ -180,12 +173,12 @@ path: '/init', | ||
case 11: | ||
case 9: | ||
response = _context.sent; | ||
_context.next = 14; | ||
_context.next = 12; | ||
return response.json(); | ||
case 14: | ||
case 12: | ||
json = _context.sent; | ||
if (!(response.status !== 200)) { | ||
_context.next = 17; | ||
_context.next = 15; | ||
break; | ||
@@ -196,3 +189,3 @@ } | ||
case 17: | ||
case 15: | ||
// If we get a valid response, save the session_id. | ||
@@ -205,3 +198,3 @@ this.sessionId = json.session_id; | ||
case 19: | ||
case 17: | ||
case "end": | ||
@@ -208,0 +201,0 @@ return _context.stop(); |
{ | ||
"name": "akio-browser", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"main": "build/akio.js", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -77,9 +77,6 @@ // Libraries | ||
// If this SDK has been init'd before, it will have a stored sessionId. | ||
const {sessionId} = this; | ||
this.token = token; | ||
if (!sessionId) { | ||
return this.logger.error(`Error initializing Akio SDK.`); | ||
} | ||
if (!token) { | ||
@@ -86,0 +83,0 @@ return this.logger.error(`'init' missing required parameter 'token'.`) |
130748
855