@como/como-client 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/como.js +19 -8
- package/package.json +1 -1
- package/src/como.js +6 -2
package/lib/como.js
CHANGED
|
@@ -4,6 +4,10 @@ var _keys = require('babel-runtime/core-js/object/keys');
|
|
|
4
4
|
|
|
5
5
|
var _keys2 = _interopRequireDefault(_keys);
|
|
6
6
|
|
|
7
|
+
var _stringify = require('babel-runtime/core-js/json/stringify');
|
|
8
|
+
|
|
9
|
+
var _stringify2 = _interopRequireDefault(_stringify);
|
|
10
|
+
|
|
7
11
|
var _promise = require('babel-runtime/core-js/promise');
|
|
8
12
|
|
|
9
13
|
var _promise2 = _interopRequireDefault(_promise);
|
|
@@ -144,7 +148,7 @@ var Como = function () {
|
|
|
144
148
|
|
|
145
149
|
var enableSignon = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
146
150
|
|
|
147
|
-
var isExists, environmentId, locationId, installationId, source, updateCredentials, getCredentials, gateway, _APIService$getServic, service, refresher, initService, accessToken, refreshToken, expiresIn, credExist, isExpired, refreshFailed, data, interval, _data;
|
|
151
|
+
var isExists, environmentId, locationId, installationId, source, updateCredentials, getCredentials, gateway, _APIService$getServic, service, refresher, initService, accessToken, refreshToken, expiresIn, credExist, isExpired, refreshFailed, data, interval, _data, _data2;
|
|
148
152
|
|
|
149
153
|
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
|
150
154
|
while (1) {
|
|
@@ -262,7 +266,7 @@ var Como = function () {
|
|
|
262
266
|
break;
|
|
263
267
|
|
|
264
268
|
case 49:
|
|
265
|
-
_context2.next =
|
|
269
|
+
_context2.next = 63;
|
|
266
270
|
break;
|
|
267
271
|
|
|
268
272
|
case 51:
|
|
@@ -273,27 +277,34 @@ var Como = function () {
|
|
|
273
277
|
return this.comoData.initApi.signOn(installationId, locationId, source, accessToken);
|
|
274
278
|
|
|
275
279
|
case 55:
|
|
276
|
-
|
|
280
|
+
_data2 = _context2.sent;
|
|
281
|
+
|
|
282
|
+
console.error('signOn with result " ' + (0, _stringify2.default)(_data2));
|
|
283
|
+
if (_data2 && _data2.accessToken) {
|
|
284
|
+
console.error('signOn entered update credentials');
|
|
285
|
+
updateCredentials(_data2, true);
|
|
286
|
+
}
|
|
287
|
+
_context2.next = 63;
|
|
277
288
|
break;
|
|
278
289
|
|
|
279
|
-
case
|
|
280
|
-
_context2.prev =
|
|
290
|
+
case 60:
|
|
291
|
+
_context2.prev = 60;
|
|
281
292
|
_context2.t2 = _context2['catch'](51);
|
|
282
293
|
|
|
283
294
|
console.log('Failed signOn with accessToken, installationId:' + installationId + ', locationId:' + locationId + ', source:' + source + ',accessToken:' + accessToken + ', error:' + _context2.t2);
|
|
284
295
|
|
|
285
|
-
case
|
|
296
|
+
case 63:
|
|
286
297
|
if (!this.comoData.token) {
|
|
287
298
|
this.comoData.token = this.comoData.accessToken;
|
|
288
299
|
}
|
|
289
300
|
return _context2.abrupt('return', this.getCredentials());
|
|
290
301
|
|
|
291
|
-
case
|
|
302
|
+
case 65:
|
|
292
303
|
case 'end':
|
|
293
304
|
return _context2.stop();
|
|
294
305
|
}
|
|
295
306
|
}
|
|
296
|
-
}, _callee2, this, [[17, 24], [32, 40], [51,
|
|
307
|
+
}, _callee2, this, [[17, 24], [32, 40], [51, 60]]);
|
|
297
308
|
}));
|
|
298
309
|
|
|
299
310
|
function init(_x, _x2, _x3) {
|
package/package.json
CHANGED
package/src/como.js
CHANGED
|
@@ -133,11 +133,15 @@ class Como {
|
|
|
133
133
|
else{
|
|
134
134
|
try{
|
|
135
135
|
console.error(`signOn with, installationId:${installationId}, locationId:${locationId}, source:${source},accessToken:${accessToken}`);
|
|
136
|
-
await this.comoData.initApi.signOn(installationId, locationId, source, accessToken);
|
|
136
|
+
const data = await this.comoData.initApi.signOn(installationId, locationId, source, accessToken);
|
|
137
|
+
console.error(`signOn with result " ${JSON.stringify(data)}`);
|
|
138
|
+
if(data && data.accessToken){
|
|
139
|
+
console.error(`signOn entered update credentials`);
|
|
140
|
+
updateCredentials(data, true);
|
|
141
|
+
}
|
|
137
142
|
}catch(e){
|
|
138
143
|
console.log(`Failed signOn with accessToken, installationId:${installationId}, locationId:${locationId}, source:${source},accessToken:${accessToken}, error:${e}`);
|
|
139
144
|
}
|
|
140
|
-
|
|
141
145
|
}
|
|
142
146
|
if(!this.comoData.token){
|
|
143
147
|
this.comoData.token = this.comoData.accessToken;
|