@como/como-client 0.1.9-1.1 → 0.1.9-1.5
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 +4 -3
- package/lib/interceptors/refresh.js +1 -1
- package/lib/services/auth.service.js +3 -3
- package/lib/services/index.js +6 -4
- package/package.json +1 -1
- package/src/como.js +4 -4
package/lib/como.js
CHANGED
|
@@ -214,7 +214,7 @@ var Como = function () {
|
|
|
214
214
|
|
|
215
215
|
getCredentials = this.getCredentials.bind(this);
|
|
216
216
|
gateway = this.comoData.env_params.gateway;
|
|
217
|
-
_APIService$getServic = APIService.getService(gateway, installationId, getCredentials, updateCredentials, source
|
|
217
|
+
_APIService$getServic = APIService.getService(gateway, installationId, getCredentials, updateCredentials, source), service = _APIService$getServic.service, refresher = _APIService$getServic.refresher;
|
|
218
218
|
|
|
219
219
|
this.comoData.api = service;
|
|
220
220
|
this.comoData.refresher = refresher;
|
|
@@ -1506,10 +1506,11 @@ var Como = function () {
|
|
|
1506
1506
|
accessToken = _comoData22.accessToken,
|
|
1507
1507
|
refreshToken = _comoData22.refreshToken,
|
|
1508
1508
|
expiresIn = _comoData22.expiresIn,
|
|
1509
|
-
consent = _comoData22.consent
|
|
1509
|
+
consent = _comoData22.consent,
|
|
1510
|
+
locationId = _comoData22.locationId;
|
|
1510
1511
|
|
|
1511
1512
|
return {
|
|
1512
|
-
accessToken: accessToken, refreshToken: refreshToken, expiresIn: expiresIn, consent: consent
|
|
1513
|
+
accessToken: accessToken, refreshToken: refreshToken, expiresIn: expiresIn, consent: consent, locationId: locationId
|
|
1513
1514
|
};
|
|
1514
1515
|
}
|
|
1515
1516
|
|
|
@@ -52,7 +52,7 @@ exports.tokenInterceptor = function (getCredentials, refresher) {
|
|
|
52
52
|
case 0:
|
|
53
53
|
_getCredentials = getCredentials(), expiresIn = _getCredentials.expiresIn;
|
|
54
54
|
|
|
55
|
-
if (!(expiresIn && isExpired(expiresIn))) {
|
|
55
|
+
if (!(expiresIn && isExpired(expiresIn) && (!config.url.toLocaleLowerCase().includes('signon') || !config.url.toLocaleLowerCase().includes('refresh')))) {
|
|
56
56
|
_context.next = 11;
|
|
57
57
|
break;
|
|
58
58
|
}
|
|
@@ -299,9 +299,9 @@ exports.logOut = function (service) {
|
|
|
299
299
|
}));
|
|
300
300
|
};
|
|
301
301
|
|
|
302
|
-
exports.refreshToken = function (service, source) {
|
|
302
|
+
exports.refreshToken = function (service, source, locationId) {
|
|
303
303
|
return function () {
|
|
304
|
-
var _ref19 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(uid, token
|
|
304
|
+
var _ref19 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(uid, token) {
|
|
305
305
|
var params, _ref20, data;
|
|
306
306
|
|
|
307
307
|
return _regenerator2.default.wrap(function _callee10$(_context10) {
|
|
@@ -325,7 +325,7 @@ exports.refreshToken = function (service, source) {
|
|
|
325
325
|
}, _callee10, undefined);
|
|
326
326
|
}));
|
|
327
327
|
|
|
328
|
-
return function (_x28, _x29
|
|
328
|
+
return function (_x28, _x29) {
|
|
329
329
|
return _ref19.apply(this, arguments);
|
|
330
330
|
};
|
|
331
331
|
}();
|
package/lib/services/index.js
CHANGED
|
@@ -28,7 +28,7 @@ var loyalty = require('./loyalty.service');
|
|
|
28
28
|
var form = require('./form.service');
|
|
29
29
|
var ssr = require('./ssr.service');
|
|
30
30
|
|
|
31
|
-
exports.getService = function (baseURL, uid, getCredentials, credentialsRefresh, source
|
|
31
|
+
exports.getService = function (baseURL, uid, getCredentials, credentialsRefresh, source) {
|
|
32
32
|
var httpClient = axios.create({ baseURL: baseURL });
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -43,11 +43,13 @@ exports.getService = function (baseURL, uid, getCredentials, credentialsRefresh,
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
var _getCredentials = getCredentials(),
|
|
46
|
-
refreshToken = _getCredentials.refreshToken
|
|
46
|
+
refreshToken = _getCredentials.refreshToken,
|
|
47
|
+
locationId = _getCredentials.locationId;
|
|
47
48
|
|
|
48
49
|
credentialsRefresh({ accessToken: false });
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
console.log('fefdsdfewfewgwgwghwh44w3h43wh3h =' + locationId);
|
|
51
|
+
var refreshService = auth.refreshToken(httpClient, source, locationId);
|
|
52
|
+
refreshPromise = refreshService(uid, refreshToken).then(function (creds) {
|
|
51
53
|
refreshPromise = null;
|
|
52
54
|
return creds;
|
|
53
55
|
});
|
package/package.json
CHANGED
package/src/como.js
CHANGED
|
@@ -95,7 +95,7 @@ class Como {
|
|
|
95
95
|
const getCredentials = this.getCredentials.bind(this);
|
|
96
96
|
const { gateway } = this.comoData.env_params;
|
|
97
97
|
const { service, refresher } = APIService
|
|
98
|
-
.getService(gateway, installationId, getCredentials, updateCredentials, source
|
|
98
|
+
.getService(gateway, installationId, getCredentials, updateCredentials, source);
|
|
99
99
|
this.comoData.api = service;
|
|
100
100
|
this.comoData.refresher = refresher;
|
|
101
101
|
|
|
@@ -112,7 +112,7 @@ class Como {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
let refreshFailed = false;
|
|
115
|
-
if(isExpired){
|
|
115
|
+
if(isExpired){
|
|
116
116
|
try{
|
|
117
117
|
await this.refreshTokenIfNeeded();
|
|
118
118
|
}catch(e){
|
|
@@ -610,10 +610,10 @@ class Como {
|
|
|
610
610
|
*/
|
|
611
611
|
getCredentials() {
|
|
612
612
|
const {
|
|
613
|
-
accessToken, refreshToken, expiresIn, consent,
|
|
613
|
+
accessToken, refreshToken, expiresIn, consent, locationId
|
|
614
614
|
} = this.comoData;
|
|
615
615
|
return {
|
|
616
|
-
accessToken, refreshToken, expiresIn, consent,
|
|
616
|
+
accessToken, refreshToken, expiresIn, consent, locationId
|
|
617
617
|
};
|
|
618
618
|
}
|
|
619
619
|
|