@smart100/spu-web-plugin 1.0.19 → 1.0.20
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/dist/index.d.ts +3 -0
- package/dist/spu-web-plugin.mjs +217 -135
- package/package.json +1 -1
- package/src/core.js +18 -4
- package/src/index.ts +8 -2
- package/src/login.ts +100 -28
- package/src/types/index.d.ts +3 -0
- package/src/types/shims-lib.d.ts +2 -0
package/dist/index.d.ts
CHANGED
|
@@ -137,6 +137,9 @@ export const updateToken: () => Promise<void>
|
|
|
137
137
|
export const getToken: () => string
|
|
138
138
|
export const getTokenExpires: () => string
|
|
139
139
|
export const getRefreshToken: () => string
|
|
140
|
+
export const setToken: (value: string) => void
|
|
141
|
+
export const setTokenExpires: (value: string) => void
|
|
142
|
+
export const setRefreshToken: (value: string) => void
|
|
140
143
|
export const getUser: (key?: string) => any
|
|
141
144
|
export const checkLogin: () => boolean
|
|
142
145
|
export const Module: any
|
package/dist/spu-web-plugin.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var version = "1.0.
|
|
1
|
+
var version = "1.0.20";
|
|
2
2
|
|
|
3
3
|
/** Detect free variable `global` from Node.js. */
|
|
4
4
|
var freeGlobal$2 = typeof global == 'object' && global && global.Object === Object && global;
|
|
@@ -8368,6 +8368,12 @@ var Core = /*#__PURE__*/function () {
|
|
|
8368
8368
|
}
|
|
8369
8369
|
return getSpuContainerType;
|
|
8370
8370
|
}()
|
|
8371
|
+
}, {
|
|
8372
|
+
key: "checkInAppSpuWebview",
|
|
8373
|
+
value: function checkInAppSpuWebview() {
|
|
8374
|
+
var _window3;
|
|
8375
|
+
return !!((_window3 = window) !== null && _window3 !== void 0 && (_window3 = _window3.aPaaS) !== null && _window3 !== void 0 && _window3.getPhoto);
|
|
8376
|
+
}
|
|
8371
8377
|
}]);
|
|
8372
8378
|
return Core;
|
|
8373
8379
|
}();
|
|
@@ -16390,13 +16396,13 @@ function getAndSetUserInfo() {
|
|
|
16390
16396
|
return _getAndSetUserInfo.apply(this, arguments);
|
|
16391
16397
|
}
|
|
16392
16398
|
function _getAndSetUserInfo() {
|
|
16393
|
-
_getAndSetUserInfo = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function
|
|
16399
|
+
_getAndSetUserInfo = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee6() {
|
|
16394
16400
|
var accountinfo;
|
|
16395
|
-
return _regeneratorRuntime$1().wrap(function
|
|
16396
|
-
while (1) switch (
|
|
16401
|
+
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
16402
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
16397
16403
|
case 0:
|
|
16398
|
-
|
|
16399
|
-
|
|
16404
|
+
_context6.prev = 0;
|
|
16405
|
+
_context6.next = 3;
|
|
16400
16406
|
return normalAxios$1.post('/api/teapi/rolepermission/account/getaccountinfo', {
|
|
16401
16407
|
positionid: getUser('positioncode') || '',
|
|
16402
16408
|
deviceinfo: '',
|
|
@@ -16410,22 +16416,22 @@ function _getAndSetUserInfo() {
|
|
|
16410
16416
|
}
|
|
16411
16417
|
});
|
|
16412
16418
|
case 3:
|
|
16413
|
-
accountinfo =
|
|
16419
|
+
accountinfo = _context6.sent;
|
|
16414
16420
|
if (accountinfo) {
|
|
16415
16421
|
setUser(accountinfo);
|
|
16416
16422
|
}
|
|
16417
|
-
|
|
16423
|
+
_context6.next = 11;
|
|
16418
16424
|
break;
|
|
16419
16425
|
case 7:
|
|
16420
|
-
|
|
16421
|
-
|
|
16422
|
-
console.error(
|
|
16426
|
+
_context6.prev = 7;
|
|
16427
|
+
_context6.t0 = _context6["catch"](0);
|
|
16428
|
+
console.error(_context6.t0);
|
|
16423
16429
|
console.warn('获取用户信息失败,当前您登录的帐号可能为非标准租户帐号。');
|
|
16424
16430
|
case 11:
|
|
16425
16431
|
case "end":
|
|
16426
|
-
return
|
|
16432
|
+
return _context6.stop();
|
|
16427
16433
|
}
|
|
16428
|
-
},
|
|
16434
|
+
}, _callee6, null, [[0, 7]]);
|
|
16429
16435
|
}));
|
|
16430
16436
|
return _getAndSetUserInfo.apply(this, arguments);
|
|
16431
16437
|
}
|
|
@@ -16458,19 +16464,19 @@ function getAndSetTenant(_x) {
|
|
|
16458
16464
|
return _getAndSetTenant.apply(this, arguments);
|
|
16459
16465
|
}
|
|
16460
16466
|
function _getAndSetTenant() {
|
|
16461
|
-
_getAndSetTenant = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function
|
|
16467
|
+
_getAndSetTenant = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee7(tenantcode) {
|
|
16462
16468
|
var tenantsRes, tenant, normalizedTenant;
|
|
16463
|
-
return _regeneratorRuntime$1().wrap(function
|
|
16464
|
-
while (1) switch (
|
|
16469
|
+
return _regeneratorRuntime$1().wrap(function _callee7$(_context7) {
|
|
16470
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
16465
16471
|
case 0:
|
|
16466
|
-
|
|
16467
|
-
|
|
16472
|
+
_context7.prev = 0;
|
|
16473
|
+
_context7.next = 3;
|
|
16468
16474
|
return normalAxios$1.get('/api/auth/tenantlist', {}).then(function (res) {
|
|
16469
16475
|
var _res$data;
|
|
16470
16476
|
return res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.tenants;
|
|
16471
16477
|
});
|
|
16472
16478
|
case 3:
|
|
16473
|
-
tenantsRes =
|
|
16479
|
+
tenantsRes = _context7.sent;
|
|
16474
16480
|
tenant = null;
|
|
16475
16481
|
if (tenantsRes !== null && tenantsRes !== void 0 && tenantsRes.length) {
|
|
16476
16482
|
if (!tenantcode) {
|
|
@@ -16491,18 +16497,18 @@ function _getAndSetTenant() {
|
|
|
16491
16497
|
cloudServ.set(normalizedTenant);
|
|
16492
16498
|
}
|
|
16493
16499
|
}
|
|
16494
|
-
|
|
16500
|
+
_context7.next = 13;
|
|
16495
16501
|
break;
|
|
16496
16502
|
case 9:
|
|
16497
|
-
|
|
16498
|
-
|
|
16499
|
-
console.error(
|
|
16503
|
+
_context7.prev = 9;
|
|
16504
|
+
_context7.t0 = _context7["catch"](0);
|
|
16505
|
+
console.error(_context7.t0);
|
|
16500
16506
|
console.warn('获取租户信息失败,当前您登录的帐号可能为非标准租户帐号。');
|
|
16501
16507
|
case 13:
|
|
16502
16508
|
case "end":
|
|
16503
|
-
return
|
|
16509
|
+
return _context7.stop();
|
|
16504
16510
|
}
|
|
16505
|
-
},
|
|
16511
|
+
}, _callee7, null, [[0, 9]]);
|
|
16506
16512
|
}));
|
|
16507
16513
|
return _getAndSetTenant.apply(this, arguments);
|
|
16508
16514
|
}
|
|
@@ -16599,8 +16605,10 @@ function startRefreshtoken() {
|
|
|
16599
16605
|
// 获取 spu 容器 token
|
|
16600
16606
|
var getSPUContainerToken = function getSPUContainerToken() {
|
|
16601
16607
|
return new Promise(function (resolve, reject) {
|
|
16602
|
-
var _window$aPaaS;
|
|
16603
|
-
|
|
16608
|
+
var _window$aPaaS, _window$aPaaS2;
|
|
16609
|
+
// 在spuwebview中
|
|
16610
|
+
if (core$1.checkInAppSpuWebview() && (_window$aPaaS = window.aPaaS) !== null && _window$aPaaS !== void 0 && _window$aPaaS.getToken) {
|
|
16611
|
+
console.log('in App spuwebview');
|
|
16604
16612
|
window.aPaaS.getToken(function (res) {
|
|
16605
16613
|
console.log('window.aPaaS.getToken success', res);
|
|
16606
16614
|
var token = res === null || res === void 0 ? void 0 : res.token;
|
|
@@ -16617,6 +16625,49 @@ var getSPUContainerToken = function getSPUContainerToken() {
|
|
|
16617
16625
|
resolve(null);
|
|
16618
16626
|
}
|
|
16619
16627
|
});
|
|
16628
|
+
} else if ((_window$aPaaS2 = window.aPaaS) !== null && _window$aPaaS2 !== void 0 && _window$aPaaS2.getToken && globalOptions.modulekey === 'portalEngine') {
|
|
16629
|
+
console.log('in App interactivewebview');
|
|
16630
|
+
// 兼容门户引擎在 interactivewebview 的情况
|
|
16631
|
+
var u = navigator.userAgent;
|
|
16632
|
+
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;
|
|
16633
|
+
if (isAndroid) {
|
|
16634
|
+
console.log('in Android, use window.aPaaS.getToken and window.getTokenComplete');
|
|
16635
|
+
window.getTokenComplete = function (res) {
|
|
16636
|
+
console.log('window.getTokenComplete success', res);
|
|
16637
|
+
var token = res === null || res === void 0 ? void 0 : res.token;
|
|
16638
|
+
var tokenexpires = res === null || res === void 0 ? void 0 : res.tokenExpires;
|
|
16639
|
+
var refreshtoken = res === null || res === void 0 ? void 0 : res.refreshToken;
|
|
16640
|
+
if (token && tokenexpires && refreshtoken) {
|
|
16641
|
+
resolve({
|
|
16642
|
+
token: token,
|
|
16643
|
+
tokenexpires: tokenexpires,
|
|
16644
|
+
refreshtoken: refreshtoken
|
|
16645
|
+
});
|
|
16646
|
+
} else {
|
|
16647
|
+
console.error('window.getTokenComplete fail');
|
|
16648
|
+
resolve(null);
|
|
16649
|
+
}
|
|
16650
|
+
};
|
|
16651
|
+
window.aPaaS.getToken(window.getTokenComplete);
|
|
16652
|
+
} else {
|
|
16653
|
+
console.log('in IOS, use window.aPaaS.getToken');
|
|
16654
|
+
window.aPaaS.getToken(function (res) {
|
|
16655
|
+
console.log('window.aPaaS.getToken success', res);
|
|
16656
|
+
var token = res === null || res === void 0 ? void 0 : res.token;
|
|
16657
|
+
var tokenexpires = res === null || res === void 0 ? void 0 : res.tokenExpires;
|
|
16658
|
+
var refreshtoken = res === null || res === void 0 ? void 0 : res.refreshToken;
|
|
16659
|
+
if (token && tokenexpires && refreshtoken) {
|
|
16660
|
+
resolve({
|
|
16661
|
+
token: token,
|
|
16662
|
+
tokenexpires: tokenexpires,
|
|
16663
|
+
refreshtoken: refreshtoken
|
|
16664
|
+
});
|
|
16665
|
+
} else {
|
|
16666
|
+
console.error('window.aPaaS.getToken fail');
|
|
16667
|
+
resolve(null);
|
|
16668
|
+
}
|
|
16669
|
+
});
|
|
16670
|
+
}
|
|
16620
16671
|
} else {
|
|
16621
16672
|
console.warn('window.aPaaS.getToken fail: not in SPU container');
|
|
16622
16673
|
resolve(null);
|
|
@@ -16630,21 +16681,26 @@ var getSPUContainerToken = function getSPUContainerToken() {
|
|
|
16630
16681
|
// 因此 在APP端 单点登录不使用url上的token 而是直接拿App端的 App端能保证拿到的token一直不过期
|
|
16631
16682
|
var fixLoginQuery = /*#__PURE__*/function () {
|
|
16632
16683
|
var _ref2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee2(query) {
|
|
16633
|
-
var _window$
|
|
16634
|
-
var newQuery,
|
|
16684
|
+
var _window$aPaaS3;
|
|
16685
|
+
var newQuery, tokenData;
|
|
16635
16686
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
16636
16687
|
while (1) switch (_context2.prev = _context2.next) {
|
|
16637
16688
|
case 0:
|
|
16638
16689
|
newQuery = cloneDeep$1(query);
|
|
16639
|
-
|
|
16640
|
-
|
|
16641
|
-
case 3:
|
|
16642
|
-
type = _context2.sent;
|
|
16643
|
-
if (!(type === 'app' && (_window$aPaaS2 = window.aPaaS) !== null && _window$aPaaS2 !== void 0 && _window$aPaaS2.getToken)) {
|
|
16644
|
-
_context2.next = 12;
|
|
16690
|
+
if ((_window$aPaaS3 = window.aPaaS) !== null && _window$aPaaS3 !== void 0 && _window$aPaaS3.getToken) {
|
|
16691
|
+
_context2.next = 5;
|
|
16645
16692
|
break;
|
|
16646
16693
|
}
|
|
16647
|
-
console.log('SPU is in App, singleLogin use
|
|
16694
|
+
console.log('SPU is not in App, singleLogin use query token.');
|
|
16695
|
+
_context2.next = 10;
|
|
16696
|
+
break;
|
|
16697
|
+
case 5:
|
|
16698
|
+
if (core$1.checkInAppSpuWebview()) {
|
|
16699
|
+
console.log('SPU is in App spuwebview, singleLogin use App token.');
|
|
16700
|
+
} else if (globalOptions.modulekey === 'portalEngine') {
|
|
16701
|
+
// 兼容门户引擎在 interactivewebview 的情况
|
|
16702
|
+
console.log('SPU is in App interactivewebview, singleLogin use App token.');
|
|
16703
|
+
}
|
|
16648
16704
|
_context2.next = 8;
|
|
16649
16705
|
return getSPUContainerToken();
|
|
16650
16706
|
case 8:
|
|
@@ -16654,13 +16710,9 @@ var fixLoginQuery = /*#__PURE__*/function () {
|
|
|
16654
16710
|
newQuery.tokenexpires = tokenData.tokenexpires;
|
|
16655
16711
|
newQuery.refreshtoken = tokenData.refreshtoken;
|
|
16656
16712
|
}
|
|
16657
|
-
|
|
16658
|
-
break;
|
|
16659
|
-
case 12:
|
|
16660
|
-
console.log('SPU is not in App, singleLogin use query token.');
|
|
16661
|
-
case 13:
|
|
16713
|
+
case 10:
|
|
16662
16714
|
return _context2.abrupt("return", newQuery);
|
|
16663
|
-
case
|
|
16715
|
+
case 11:
|
|
16664
16716
|
case "end":
|
|
16665
16717
|
return _context2.stop();
|
|
16666
16718
|
}
|
|
@@ -16670,64 +16722,94 @@ var fixLoginQuery = /*#__PURE__*/function () {
|
|
|
16670
16722
|
return _ref2.apply(this, arguments);
|
|
16671
16723
|
};
|
|
16672
16724
|
}();
|
|
16673
|
-
|
|
16674
|
-
|
|
16675
|
-
var
|
|
16676
|
-
|
|
16677
|
-
|
|
16678
|
-
|
|
16679
|
-
|
|
16680
|
-
|
|
16681
|
-
|
|
16682
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
16683
|
-
case 0:
|
|
16684
|
-
console.log('App enter forceground');
|
|
16685
|
-
loginState = getLoginState();
|
|
16686
|
-
if (!(!loginState.islogin && loginState.type === 2 && loginState.role !== 'center')) {
|
|
16687
|
-
_context3.next = 20;
|
|
16688
|
-
break;
|
|
16689
|
-
}
|
|
16690
|
-
_context3.next = 5;
|
|
16691
|
-
return getSPUContainerToken();
|
|
16692
|
-
case 5:
|
|
16693
|
-
tokenData = _context3.sent;
|
|
16694
|
-
if (!tokenData) {
|
|
16695
|
-
_context3.next = 12;
|
|
16696
|
-
break;
|
|
16697
|
-
}
|
|
16698
|
-
setToken(tokenData.token);
|
|
16699
|
-
setRefreshToken(tokenData.refreshtoken);
|
|
16700
|
-
setTokenExpires(tokenData.tokenexpires);
|
|
16701
|
-
_context3.next = 20;
|
|
16725
|
+
var checkTokenExpiredAndUpdate = /*#__PURE__*/function () {
|
|
16726
|
+
var _ref3 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee3() {
|
|
16727
|
+
var loginState, tokenData;
|
|
16728
|
+
return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
|
|
16729
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
16730
|
+
case 0:
|
|
16731
|
+
loginState = getLoginState();
|
|
16732
|
+
if (!(!loginState.islogin && loginState.type === 2 && loginState.role !== 'center')) {
|
|
16733
|
+
_context3.next = 19;
|
|
16702
16734
|
break;
|
|
16703
|
-
|
|
16704
|
-
|
|
16705
|
-
|
|
16706
|
-
|
|
16707
|
-
|
|
16708
|
-
|
|
16735
|
+
}
|
|
16736
|
+
_context3.next = 4;
|
|
16737
|
+
return getSPUContainerToken();
|
|
16738
|
+
case 4:
|
|
16739
|
+
tokenData = _context3.sent;
|
|
16740
|
+
if (!tokenData) {
|
|
16741
|
+
_context3.next = 11;
|
|
16709
16742
|
break;
|
|
16710
|
-
|
|
16711
|
-
|
|
16712
|
-
|
|
16713
|
-
|
|
16714
|
-
|
|
16715
|
-
|
|
16716
|
-
|
|
16717
|
-
|
|
16718
|
-
|
|
16719
|
-
|
|
16720
|
-
|
|
16721
|
-
|
|
16743
|
+
}
|
|
16744
|
+
setToken(tokenData.token);
|
|
16745
|
+
setRefreshToken(tokenData.refreshtoken);
|
|
16746
|
+
setTokenExpires(tokenData.tokenexpires);
|
|
16747
|
+
_context3.next = 19;
|
|
16748
|
+
break;
|
|
16749
|
+
case 11:
|
|
16750
|
+
_context3.prev = 11;
|
|
16751
|
+
_context3.next = 14;
|
|
16752
|
+
return updateToken();
|
|
16753
|
+
case 14:
|
|
16754
|
+
_context3.next = 19;
|
|
16755
|
+
break;
|
|
16756
|
+
case 16:
|
|
16757
|
+
_context3.prev = 16;
|
|
16758
|
+
_context3.t0 = _context3["catch"](11);
|
|
16759
|
+
console.error(_context3.t0);
|
|
16760
|
+
case 19:
|
|
16761
|
+
case "end":
|
|
16762
|
+
return _context3.stop();
|
|
16763
|
+
}
|
|
16764
|
+
}, _callee3, null, [[11, 16]]);
|
|
16765
|
+
}));
|
|
16766
|
+
return function checkTokenExpiredAndUpdate() {
|
|
16767
|
+
return _ref3.apply(this, arguments);
|
|
16768
|
+
};
|
|
16769
|
+
}();
|
|
16770
|
+
// 修复 App 切到后台时间过长导致 token 过期
|
|
16771
|
+
// 监听 App 切换到前台 判断token是否过期 如果过期就调用获取tokne方法更新token
|
|
16772
|
+
var fixAppTokenExpired = /*#__PURE__*/function () {
|
|
16773
|
+
var _ref4 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee4() {
|
|
16774
|
+
var _window$Native, _window$aPaaS4;
|
|
16775
|
+
return _regeneratorRuntime$1().wrap(function _callee4$(_context4) {
|
|
16776
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
16777
|
+
case 0:
|
|
16778
|
+
if (globalOptions.isfixapptokenexpired && core$1.checkInAppSpuWebview() && (_window$Native = window.Native) !== null && _window$Native !== void 0 && _window$Native.onHostEnterForceground) {
|
|
16779
|
+
console.log('SPU is in App spuwebview, listen App enter forceground.');
|
|
16780
|
+
window.Native.onHostEnterForceground(function () {
|
|
16781
|
+
console.log('App enter forceground');
|
|
16782
|
+
checkTokenExpiredAndUpdate();
|
|
16783
|
+
});
|
|
16784
|
+
} else if (globalOptions.isfixapptokenexpired && globalOptions.modulekey === 'portalEngine' && (_window$aPaaS4 = window.aPaaS) !== null && _window$aPaaS4 !== void 0 && _window$aPaaS4.getToken) {
|
|
16785
|
+
console.log('SPU is in App interactivewebview, listen App enter forceground.');
|
|
16786
|
+
setTimeout(function () {
|
|
16787
|
+
window.Native = window.Native || {};
|
|
16788
|
+
window.Native.onHostEnterForceground = function () {
|
|
16789
|
+
console.log('App enter forceground');
|
|
16790
|
+
checkTokenExpiredAndUpdate();
|
|
16791
|
+
};
|
|
16792
|
+
}, 1000);
|
|
16793
|
+
}
|
|
16794
|
+
case 1:
|
|
16795
|
+
case "end":
|
|
16796
|
+
return _context4.stop();
|
|
16797
|
+
}
|
|
16798
|
+
}, _callee4);
|
|
16799
|
+
}));
|
|
16800
|
+
return function fixAppTokenExpired() {
|
|
16801
|
+
return _ref4.apply(this, arguments);
|
|
16802
|
+
};
|
|
16803
|
+
}();
|
|
16722
16804
|
// 单点登录
|
|
16723
16805
|
function singleLogin(_x3) {
|
|
16724
16806
|
return _singleLogin.apply(this, arguments);
|
|
16725
16807
|
}
|
|
16726
16808
|
function _singleLogin() {
|
|
16727
|
-
_singleLogin = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function
|
|
16809
|
+
_singleLogin = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee8(query) {
|
|
16728
16810
|
var flag, token, refreshtoken, tokenexpires, envname, context, setBaseInfo, isneedlogin, loginRole, refreshTokenUser, tokenUser, nowEnvname, envData;
|
|
16729
|
-
return _regeneratorRuntime$1().wrap(function
|
|
16730
|
-
while (1) switch (
|
|
16811
|
+
return _regeneratorRuntime$1().wrap(function _callee8$(_context8) {
|
|
16812
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
16731
16813
|
case 0:
|
|
16732
16814
|
setBaseInfo = function _setBaseInfo() {
|
|
16733
16815
|
setToken(token);
|
|
@@ -16741,13 +16823,13 @@ function _singleLogin() {
|
|
|
16741
16823
|
};
|
|
16742
16824
|
query = cloneDeep$1(query);
|
|
16743
16825
|
if (!globalOptions.isfixapptokenexpired) {
|
|
16744
|
-
|
|
16826
|
+
_context8.next = 6;
|
|
16745
16827
|
break;
|
|
16746
16828
|
}
|
|
16747
|
-
|
|
16829
|
+
_context8.next = 5;
|
|
16748
16830
|
return fixLoginQuery(query);
|
|
16749
16831
|
case 5:
|
|
16750
|
-
query =
|
|
16832
|
+
query = _context8.sent;
|
|
16751
16833
|
case 6:
|
|
16752
16834
|
flag = false; // 是否登录成功
|
|
16753
16835
|
token = query.token;
|
|
@@ -16756,7 +16838,7 @@ function _singleLogin() {
|
|
|
16756
16838
|
envname = query.envname;
|
|
16757
16839
|
context = query.context;
|
|
16758
16840
|
if (!checkLoginByToken(token)) {
|
|
16759
|
-
|
|
16841
|
+
_context8.next = 64;
|
|
16760
16842
|
break;
|
|
16761
16843
|
}
|
|
16762
16844
|
isneedlogin = true; // 是否需要走单点登录流程
|
|
@@ -16778,91 +16860,91 @@ function _singleLogin() {
|
|
|
16778
16860
|
// isneedlogin = true
|
|
16779
16861
|
// debugger
|
|
16780
16862
|
if (!isneedlogin) {
|
|
16781
|
-
|
|
16863
|
+
_context8.next = 62;
|
|
16782
16864
|
break;
|
|
16783
16865
|
}
|
|
16784
16866
|
setBaseInfo();
|
|
16785
16867
|
// 单点登录写入 token 之后
|
|
16786
16868
|
// 1、如果 refreshtoken 不完整 则换取完整的 refreshtoken
|
|
16787
|
-
|
|
16869
|
+
_context8.prev = 18;
|
|
16788
16870
|
if (!checkLogin()) {
|
|
16789
|
-
|
|
16871
|
+
_context8.next = 25;
|
|
16790
16872
|
break;
|
|
16791
16873
|
}
|
|
16792
16874
|
refreshTokenUser = getUserByToken(getRefreshToken());
|
|
16793
16875
|
tokenUser = getUserByToken(getToken());
|
|
16794
16876
|
if (!(!(refreshTokenUser !== null && refreshTokenUser !== void 0 && refreshTokenUser.tokenId) && tokenUser !== null && tokenUser !== void 0 && tokenUser.tokenId)) {
|
|
16795
|
-
|
|
16877
|
+
_context8.next = 25;
|
|
16796
16878
|
break;
|
|
16797
16879
|
}
|
|
16798
|
-
|
|
16880
|
+
_context8.next = 25;
|
|
16799
16881
|
return updateToken();
|
|
16800
16882
|
case 25:
|
|
16801
|
-
|
|
16883
|
+
_context8.next = 30;
|
|
16802
16884
|
break;
|
|
16803
16885
|
case 27:
|
|
16804
|
-
|
|
16805
|
-
|
|
16806
|
-
console.error(
|
|
16886
|
+
_context8.prev = 27;
|
|
16887
|
+
_context8.t0 = _context8["catch"](18);
|
|
16888
|
+
console.error(_context8.t0);
|
|
16807
16889
|
case 30:
|
|
16808
16890
|
// 2、重新计算刷新 token 时间 因为刚开始进入就 startRefreshtoken 检测到没有 token 会过10秒才执行刷新 token 操作
|
|
16809
16891
|
startRefreshtoken();
|
|
16810
16892
|
// 获取环境信息和租户配置信息
|
|
16811
|
-
|
|
16893
|
+
_context8.next = 33;
|
|
16812
16894
|
return getEnvname();
|
|
16813
16895
|
case 33:
|
|
16814
|
-
nowEnvname =
|
|
16896
|
+
nowEnvname = _context8.sent;
|
|
16815
16897
|
if (!nowEnvname) {
|
|
16816
|
-
|
|
16898
|
+
_context8.next = 54;
|
|
16817
16899
|
break;
|
|
16818
16900
|
}
|
|
16819
|
-
|
|
16901
|
+
_context8.next = 37;
|
|
16820
16902
|
return requestEnvdata(nowEnvname);
|
|
16821
16903
|
case 37:
|
|
16822
|
-
envData =
|
|
16904
|
+
envData = _context8.sent;
|
|
16823
16905
|
if (!envData) {
|
|
16824
|
-
|
|
16906
|
+
_context8.next = 50;
|
|
16825
16907
|
break;
|
|
16826
16908
|
}
|
|
16827
16909
|
saveEnvdata(envData);
|
|
16828
16910
|
if (!envData.tenantcode) {
|
|
16829
|
-
|
|
16911
|
+
_context8.next = 46;
|
|
16830
16912
|
break;
|
|
16831
16913
|
}
|
|
16832
16914
|
setTecode(envData.tenantcode);
|
|
16833
16915
|
// 租户配置
|
|
16834
|
-
|
|
16916
|
+
_context8.next = 44;
|
|
16835
16917
|
return tenantSetting.requestAndSetTenantSetting(envData.tenantcode);
|
|
16836
16918
|
case 44:
|
|
16837
|
-
|
|
16919
|
+
_context8.next = 48;
|
|
16838
16920
|
break;
|
|
16839
16921
|
case 46:
|
|
16840
16922
|
tenantSetting.removeTenantSetting();
|
|
16841
16923
|
removeTecode();
|
|
16842
16924
|
case 48:
|
|
16843
|
-
|
|
16925
|
+
_context8.next = 52;
|
|
16844
16926
|
break;
|
|
16845
16927
|
case 50:
|
|
16846
16928
|
removeEnvdata();
|
|
16847
16929
|
removeTecode();
|
|
16848
16930
|
case 52:
|
|
16849
|
-
|
|
16931
|
+
_context8.next = 56;
|
|
16850
16932
|
break;
|
|
16851
16933
|
case 54:
|
|
16852
16934
|
removeEnvdata();
|
|
16853
16935
|
removeTecode();
|
|
16854
16936
|
case 56:
|
|
16855
|
-
|
|
16937
|
+
_context8.next = 58;
|
|
16856
16938
|
return getAndSetTenant();
|
|
16857
16939
|
case 58:
|
|
16858
|
-
|
|
16940
|
+
_context8.next = 60;
|
|
16859
16941
|
return getAndSetUserInfo();
|
|
16860
16942
|
case 60:
|
|
16861
16943
|
// 单点登录后 获取 web 开发者模式 如果是则设置 isdebugger
|
|
16862
16944
|
urlquery.dealWebDebugger();
|
|
16863
16945
|
flag = true;
|
|
16864
16946
|
case 62:
|
|
16865
|
-
|
|
16947
|
+
_context8.next = 67;
|
|
16866
16948
|
break;
|
|
16867
16949
|
case 64:
|
|
16868
16950
|
flag = false;
|
|
@@ -16870,10 +16952,10 @@ function _singleLogin() {
|
|
|
16870
16952
|
console.error('单点登录失败,请检查链接所传 token/refreshtoken/tokenexpires 是否非法或过期。');
|
|
16871
16953
|
case 67:
|
|
16872
16954
|
if (!flag) {
|
|
16873
|
-
|
|
16955
|
+
_context8.next = 70;
|
|
16874
16956
|
break;
|
|
16875
16957
|
}
|
|
16876
|
-
|
|
16958
|
+
_context8.next = 70;
|
|
16877
16959
|
return core$1.initGetData();
|
|
16878
16960
|
case 70:
|
|
16879
16961
|
if (flag) {
|
|
@@ -16884,15 +16966,15 @@ function _singleLogin() {
|
|
|
16884
16966
|
envname && delete query.envname;
|
|
16885
16967
|
context && delete query.context;
|
|
16886
16968
|
}
|
|
16887
|
-
return
|
|
16969
|
+
return _context8.abrupt("return", {
|
|
16888
16970
|
flag: flag,
|
|
16889
16971
|
query: query
|
|
16890
16972
|
});
|
|
16891
16973
|
case 72:
|
|
16892
16974
|
case "end":
|
|
16893
|
-
return
|
|
16975
|
+
return _context8.stop();
|
|
16894
16976
|
}
|
|
16895
|
-
},
|
|
16977
|
+
}, _callee8, null, [[18, 27]]);
|
|
16896
16978
|
}));
|
|
16897
16979
|
return _singleLogin.apply(this, arguments);
|
|
16898
16980
|
}
|
|
@@ -16901,19 +16983,19 @@ function installAuth(options) {
|
|
|
16901
16983
|
fixAppTokenExpired();
|
|
16902
16984
|
if (options.router) {
|
|
16903
16985
|
options.router.beforeEach( /*#__PURE__*/function () {
|
|
16904
|
-
var
|
|
16986
|
+
var _ref5 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee5(to, from, next) {
|
|
16905
16987
|
var singleLoginRes;
|
|
16906
|
-
return _regeneratorRuntime$1().wrap(function
|
|
16907
|
-
while (1) switch (
|
|
16988
|
+
return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
|
|
16989
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
16908
16990
|
case 0:
|
|
16909
16991
|
if (!to.query.token) {
|
|
16910
|
-
|
|
16992
|
+
_context5.next = 8;
|
|
16911
16993
|
break;
|
|
16912
16994
|
}
|
|
16913
|
-
|
|
16995
|
+
_context5.next = 3;
|
|
16914
16996
|
return singleLogin(to.query);
|
|
16915
16997
|
case 3:
|
|
16916
|
-
singleLoginRes =
|
|
16998
|
+
singleLoginRes = _context5.sent;
|
|
16917
16999
|
if (singleLoginRes.flag) {
|
|
16918
17000
|
// next()
|
|
16919
17001
|
next({
|
|
@@ -16925,18 +17007,18 @@ function installAuth(options) {
|
|
|
16925
17007
|
next();
|
|
16926
17008
|
}
|
|
16927
17009
|
options.singleLoginCallback && options.singleLoginCallback(singleLoginRes);
|
|
16928
|
-
|
|
17010
|
+
_context5.next = 9;
|
|
16929
17011
|
break;
|
|
16930
17012
|
case 8:
|
|
16931
17013
|
next();
|
|
16932
17014
|
case 9:
|
|
16933
17015
|
case "end":
|
|
16934
|
-
return
|
|
17016
|
+
return _context5.stop();
|
|
16935
17017
|
}
|
|
16936
|
-
},
|
|
17018
|
+
}, _callee5);
|
|
16937
17019
|
}));
|
|
16938
17020
|
return function (_x4, _x5, _x6) {
|
|
16939
|
-
return
|
|
17021
|
+
return _ref5.apply(this, arguments);
|
|
16940
17022
|
};
|
|
16941
17023
|
}());
|
|
16942
17024
|
} else {
|
|
@@ -70360,4 +70442,4 @@ var SPUWebPlugin = {
|
|
|
70360
70442
|
version: version
|
|
70361
70443
|
};
|
|
70362
70444
|
|
|
70363
|
-
export { AMapLoader, Module, normalAxios$1 as apaasAxios, normalAxios$1 as axios, checkLogin, index as components, SPUWebPlugin as default, downloadService, expandexp, functionCheck, getAddress, getCloudServ, getDistance, getLocation, getRefreshToken, getServToken, getServerTime, getToken, getTokenExpires, getUniqueid, getUser, v4 as getUuid, globalConfig, globalOptions, isInApp, isdebugger, isvirtuallocation, lsProxy, mapService, setTitle, singleLogin, spuAxios, spuConfig, ssProxy, updateToken, uploadService, wxworkSuite };
|
|
70445
|
+
export { AMapLoader, Module, normalAxios$1 as apaasAxios, normalAxios$1 as axios, checkLogin, index as components, SPUWebPlugin as default, downloadService, expandexp, functionCheck, getAddress, getCloudServ, getDistance, getLocation, getRefreshToken, getServToken, getServerTime, getToken, getTokenExpires, getUniqueid, getUser, v4 as getUuid, globalConfig, globalOptions, isInApp, isdebugger, isvirtuallocation, lsProxy, mapService, setRefreshToken, setTitle, setToken, setTokenExpires, singleLogin, spuAxios, spuConfig, ssProxy, updateToken, uploadService, wxworkSuite };
|
package/package.json
CHANGED
package/src/core.js
CHANGED
|
@@ -40,7 +40,11 @@ class Core {
|
|
|
40
40
|
const nowEnvname = await getEnvname()
|
|
41
41
|
const nowTenantCode = getUser('tenantcode') || ''
|
|
42
42
|
// console.log(tenantCode)
|
|
43
|
-
if (
|
|
43
|
+
if (
|
|
44
|
+
this.cache.envName === nowEnvname &&
|
|
45
|
+
this.cache.tenantCode === nowTenantCode &&
|
|
46
|
+
this.loadStatus === 2
|
|
47
|
+
) {
|
|
44
48
|
return this.cache
|
|
45
49
|
}
|
|
46
50
|
|
|
@@ -332,7 +336,9 @@ class Core {
|
|
|
332
336
|
if (!indextag) {
|
|
333
337
|
errorMsg = '缺少 indextag,请检查。'
|
|
334
338
|
} else {
|
|
335
|
-
indextagData = (moduleData.data.protocol.indexs || []).find(
|
|
339
|
+
indextagData = (moduleData.data.protocol.indexs || []).find(
|
|
340
|
+
(item) => item.indextag === indextag
|
|
341
|
+
)
|
|
336
342
|
if (indextagData) {
|
|
337
343
|
const queryUrl = this.getQueryUrl(indextagData.query || [], queryvalue)
|
|
338
344
|
const context = await this.getContext(modulekey)
|
|
@@ -348,9 +354,13 @@ class Core {
|
|
|
348
354
|
}
|
|
349
355
|
|
|
350
356
|
if (url.indexOf('?') === -1) {
|
|
351
|
-
url += `?${queryUrl}indextag=${indextag}&context=${encodeURIComponent(
|
|
357
|
+
url += `?${queryUrl}indextag=${indextag}&context=${encodeURIComponent(
|
|
358
|
+
JSON.stringify(context)
|
|
359
|
+
)}`
|
|
352
360
|
} else {
|
|
353
|
-
url += `&${queryUrl}indextag=${indextag}&context=${encodeURIComponent(
|
|
361
|
+
url += `&${queryUrl}indextag=${indextag}&context=${encodeURIComponent(
|
|
362
|
+
JSON.stringify(context)
|
|
363
|
+
)}`
|
|
354
364
|
}
|
|
355
365
|
} else {
|
|
356
366
|
errorMsg = `找不到 indextag = ${indextag} 的页面信息。`
|
|
@@ -405,6 +415,10 @@ class Core {
|
|
|
405
415
|
return ''
|
|
406
416
|
}
|
|
407
417
|
}
|
|
418
|
+
|
|
419
|
+
checkInAppSpuWebview() {
|
|
420
|
+
return !!window?.aPaaS?.getPhoto
|
|
421
|
+
}
|
|
408
422
|
}
|
|
409
423
|
|
|
410
424
|
const core = new Core()
|
package/src/index.ts
CHANGED
|
@@ -23,10 +23,13 @@ import { mapService } from './map/MapService'
|
|
|
23
23
|
import AMapLoader from './map/AMapLoader'
|
|
24
24
|
import {
|
|
25
25
|
getToken,
|
|
26
|
-
|
|
27
|
-
getUser,
|
|
26
|
+
setToken,
|
|
28
27
|
getRefreshToken,
|
|
28
|
+
setRefreshToken,
|
|
29
29
|
getTokenExpires,
|
|
30
|
+
setTokenExpires,
|
|
31
|
+
checkLogin,
|
|
32
|
+
getUser,
|
|
30
33
|
updateToken,
|
|
31
34
|
singleLogin,
|
|
32
35
|
installAuth
|
|
@@ -135,6 +138,9 @@ export {
|
|
|
135
138
|
getToken,
|
|
136
139
|
getTokenExpires,
|
|
137
140
|
getRefreshToken,
|
|
141
|
+
setToken,
|
|
142
|
+
setTokenExpires,
|
|
143
|
+
setRefreshToken,
|
|
138
144
|
getUser,
|
|
139
145
|
checkLogin,
|
|
140
146
|
Module,
|
package/src/login.ts
CHANGED
|
@@ -455,7 +455,9 @@ function startRefreshtoken() {
|
|
|
455
455
|
// 获取 spu 容器 token
|
|
456
456
|
const getSPUContainerToken = (): Promise<any> => {
|
|
457
457
|
return new Promise((resolve, reject) => {
|
|
458
|
-
|
|
458
|
+
// 在spuwebview中
|
|
459
|
+
if (core.checkInAppSpuWebview() && window.aPaaS?.getToken) {
|
|
460
|
+
console.log('in App spuwebview')
|
|
459
461
|
window.aPaaS.getToken((res: any) => {
|
|
460
462
|
console.log('window.aPaaS.getToken success', res)
|
|
461
463
|
const token = res?.token
|
|
@@ -473,6 +475,50 @@ const getSPUContainerToken = (): Promise<any> => {
|
|
|
473
475
|
resolve(null)
|
|
474
476
|
}
|
|
475
477
|
})
|
|
478
|
+
} else if (window.aPaaS?.getToken && globalOptions.modulekey === 'portalEngine') {
|
|
479
|
+
console.log('in App interactivewebview')
|
|
480
|
+
// 兼容门户引擎在 interactivewebview 的情况
|
|
481
|
+
const u = navigator.userAgent
|
|
482
|
+
const isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1
|
|
483
|
+
if (isAndroid) {
|
|
484
|
+
console.log('in Android, use window.aPaaS.getToken and window.getTokenComplete')
|
|
485
|
+
window.getTokenComplete = (res: any) => {
|
|
486
|
+
console.log('window.getTokenComplete success', res)
|
|
487
|
+
const token = res?.token
|
|
488
|
+
const tokenexpires = res?.tokenExpires
|
|
489
|
+
const refreshtoken = res?.refreshToken
|
|
490
|
+
if (token && tokenexpires && refreshtoken) {
|
|
491
|
+
resolve({
|
|
492
|
+
token,
|
|
493
|
+
tokenexpires,
|
|
494
|
+
refreshtoken
|
|
495
|
+
})
|
|
496
|
+
} else {
|
|
497
|
+
console.error('window.getTokenComplete fail')
|
|
498
|
+
resolve(null)
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
window.aPaaS.getToken(window.getTokenComplete)
|
|
502
|
+
} else {
|
|
503
|
+
console.log('in IOS, use window.aPaaS.getToken')
|
|
504
|
+
window.aPaaS.getToken((res: any) => {
|
|
505
|
+
console.log('window.aPaaS.getToken success', res)
|
|
506
|
+
const token = res?.token
|
|
507
|
+
const tokenexpires = res?.tokenExpires
|
|
508
|
+
const refreshtoken = res?.refreshToken
|
|
509
|
+
|
|
510
|
+
if (token && tokenexpires && refreshtoken) {
|
|
511
|
+
resolve({
|
|
512
|
+
token,
|
|
513
|
+
tokenexpires,
|
|
514
|
+
refreshtoken
|
|
515
|
+
})
|
|
516
|
+
} else {
|
|
517
|
+
console.error('window.aPaaS.getToken fail')
|
|
518
|
+
resolve(null)
|
|
519
|
+
}
|
|
520
|
+
})
|
|
521
|
+
}
|
|
476
522
|
} else {
|
|
477
523
|
console.warn('window.aPaaS.getToken fail: not in SPU container')
|
|
478
524
|
resolve(null)
|
|
@@ -487,44 +533,70 @@ const getSPUContainerToken = (): Promise<any> => {
|
|
|
487
533
|
// 因此 在APP端 单点登录不使用url上的token 而是直接拿App端的 App端能保证拿到的token一直不过期
|
|
488
534
|
const fixLoginQuery = async (query: IAny) => {
|
|
489
535
|
const newQuery = cloneDeep(query)
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
536
|
+
if (!window.aPaaS?.getToken) {
|
|
537
|
+
console.log('SPU is not in App, singleLogin use query token.')
|
|
538
|
+
} else {
|
|
539
|
+
if (core.checkInAppSpuWebview()) {
|
|
540
|
+
console.log('SPU is in App spuwebview, singleLogin use App token.')
|
|
541
|
+
} else if (globalOptions.modulekey === 'portalEngine') {
|
|
542
|
+
// 兼容门户引擎在 interactivewebview 的情况
|
|
543
|
+
console.log('SPU is in App interactivewebview, singleLogin use App token.')
|
|
544
|
+
}
|
|
493
545
|
const tokenData = await getSPUContainerToken()
|
|
494
546
|
if (tokenData) {
|
|
495
547
|
newQuery.token = tokenData.token
|
|
496
548
|
newQuery.tokenexpires = tokenData.tokenexpires
|
|
497
549
|
newQuery.refreshtoken = tokenData.refreshtoken
|
|
498
550
|
}
|
|
499
|
-
} else {
|
|
500
|
-
console.log('SPU is not in App, singleLogin use query token.')
|
|
501
551
|
}
|
|
552
|
+
|
|
502
553
|
return newQuery
|
|
503
554
|
}
|
|
504
555
|
|
|
556
|
+
const checkTokenExpiredAndUpdate = async () => {
|
|
557
|
+
const loginState = getLoginState()
|
|
558
|
+
if (!loginState.islogin && loginState.type === 2 && loginState.role !== 'center') {
|
|
559
|
+
const tokenData = await getSPUContainerToken()
|
|
560
|
+
if (tokenData) {
|
|
561
|
+
setToken(tokenData.token)
|
|
562
|
+
setRefreshToken(tokenData.refreshtoken)
|
|
563
|
+
setTokenExpires(tokenData.tokenexpires)
|
|
564
|
+
} else {
|
|
565
|
+
try {
|
|
566
|
+
await updateToken()
|
|
567
|
+
} catch (err) {
|
|
568
|
+
console.error(err)
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
|
|
505
574
|
// 修复 App 切到后台时间过长导致 token 过期
|
|
506
575
|
// 监听 App 切换到前台 判断token是否过期 如果过期就调用获取tokne方法更新token
|
|
507
|
-
const fixAppTokenExpired = () => {
|
|
508
|
-
if (
|
|
509
|
-
|
|
510
|
-
|
|
576
|
+
const fixAppTokenExpired = async () => {
|
|
577
|
+
if (
|
|
578
|
+
globalOptions.isfixapptokenexpired &&
|
|
579
|
+
core.checkInAppSpuWebview() &&
|
|
580
|
+
window.Native?.onHostEnterForceground
|
|
581
|
+
) {
|
|
582
|
+
console.log('SPU is in App spuwebview, listen App enter forceground.')
|
|
583
|
+
window.Native.onHostEnterForceground(() => {
|
|
511
584
|
console.log('App enter forceground')
|
|
512
|
-
|
|
513
|
-
if (!loginState.islogin && loginState.type === 2 && loginState.role !== 'center') {
|
|
514
|
-
const tokenData = await getSPUContainerToken()
|
|
515
|
-
if (tokenData) {
|
|
516
|
-
setToken(tokenData.token)
|
|
517
|
-
setRefreshToken(tokenData.refreshtoken)
|
|
518
|
-
setTokenExpires(tokenData.tokenexpires)
|
|
519
|
-
} else {
|
|
520
|
-
try {
|
|
521
|
-
await updateToken()
|
|
522
|
-
} catch (err) {
|
|
523
|
-
console.error(err)
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
}
|
|
585
|
+
checkTokenExpiredAndUpdate()
|
|
527
586
|
})
|
|
587
|
+
} else if (
|
|
588
|
+
globalOptions.isfixapptokenexpired &&
|
|
589
|
+
globalOptions.modulekey === 'portalEngine' &&
|
|
590
|
+
window.aPaaS?.getToken
|
|
591
|
+
) {
|
|
592
|
+
console.log('SPU is in App interactivewebview, listen App enter forceground.')
|
|
593
|
+
setTimeout(() => {
|
|
594
|
+
window.Native = window.Native || {}
|
|
595
|
+
window.Native.onHostEnterForceground = () => {
|
|
596
|
+
console.log('App enter forceground')
|
|
597
|
+
checkTokenExpiredAndUpdate()
|
|
598
|
+
}
|
|
599
|
+
}, 1000)
|
|
528
600
|
}
|
|
529
601
|
}
|
|
530
602
|
|
|
@@ -700,13 +772,13 @@ function installAuth(options: any) {
|
|
|
700
772
|
export {
|
|
701
773
|
installAuth,
|
|
702
774
|
getToken,
|
|
703
|
-
|
|
775
|
+
setToken,
|
|
704
776
|
// removeToken,
|
|
705
777
|
getTokenExpires,
|
|
706
|
-
|
|
778
|
+
setTokenExpires,
|
|
707
779
|
// removeTokenExpires,
|
|
708
780
|
getRefreshToken,
|
|
709
|
-
|
|
781
|
+
setRefreshToken,
|
|
710
782
|
// removeRefreshToken,
|
|
711
783
|
updateToken,
|
|
712
784
|
// startRefreshtoken,
|
package/src/types/index.d.ts
CHANGED
|
@@ -137,6 +137,9 @@ export const updateToken: () => Promise<void>
|
|
|
137
137
|
export const getToken: () => string
|
|
138
138
|
export const getTokenExpires: () => string
|
|
139
139
|
export const getRefreshToken: () => string
|
|
140
|
+
export const setToken: (value: string) => void
|
|
141
|
+
export const setTokenExpires: (value: string) => void
|
|
142
|
+
export const setRefreshToken: (value: string) => void
|
|
140
143
|
export const getUser: (key?: string) => any
|
|
141
144
|
export const checkLogin: () => boolean
|
|
142
145
|
export const Module: any
|