ntk-cms-api 18.3.465 → 18.3.467

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.
@@ -1151,16 +1151,21 @@ class ApiServerBase {
1151
1151
  this.keyJwt = 'jwtToken';
1152
1152
  this.keyDeviceToken = 'deviceToken';
1153
1153
  this.keyBaseUrl = 'baseUrl';
1154
+ this.keyBaseVer = '';
1154
1155
  this.accessLoad = false;
1155
1156
  this.cachApiResult = [];
1156
1157
  this.childConstructor();
1157
1158
  this.headers = new Map();
1158
1159
  }
1159
- setConfig(url, apiRetry = 1) {
1160
+ setConfig(url, ver = '', apiRetry = 1) {
1160
1161
  this.baseUrl = url;
1161
- localStorage.setItem(this.keyBaseUrl, url);
1162
+ localStorage.setItem(this.Ver + this.keyBaseUrl, url);
1163
+ localStorage.setItem(this.keyBaseVer, ver);
1162
1164
  this.configApiRetry = apiRetry;
1163
1165
  }
1166
+ get Ver() {
1167
+ return localStorage.getItem(this.keyBaseVer) + '';
1168
+ }
1164
1169
  cashApiIsValid(serviceNameKay, cashApiSeconds) {
1165
1170
  if (cashApiSeconds > 0) {
1166
1171
  if (!this.cachApiResult[serviceNameKay])
@@ -1176,7 +1181,7 @@ class ApiServerBase {
1176
1181
  // test
1177
1182
  }
1178
1183
  getBaseUrl() {
1179
- const BaseUrl = localStorage.getItem(this.keyBaseUrl);
1184
+ const BaseUrl = localStorage.getItem(this.Ver + this.keyBaseUrl);
1180
1185
  if (BaseUrl && BaseUrl.length > 0) {
1181
1186
  return BaseUrl;
1182
1187
  }
@@ -1210,7 +1215,7 @@ class ApiServerBase {
1210
1215
  if (this.deviceToken && this.deviceToken.length > 0) {
1211
1216
  return this.deviceToken;
1212
1217
  }
1213
- const token = localStorage.getItem(this.keyDeviceToken);
1218
+ const token = localStorage.getItem(this.Ver + this.keyDeviceToken);
1214
1219
  if (token && token.length > 0) {
1215
1220
  return token;
1216
1221
  }
@@ -1218,30 +1223,30 @@ class ApiServerBase {
1218
1223
  }
1219
1224
  setDeviceToken(deviceToken) {
1220
1225
  if (!deviceToken || deviceToken.length === 0) {
1221
- localStorage.removeItem(this.keyDeviceToken);
1226
+ localStorage.removeItem(this.Ver + this.keyDeviceToken);
1222
1227
  return;
1223
1228
  }
1224
- localStorage.setItem(this.keyDeviceToken, deviceToken);
1229
+ localStorage.setItem(this.Ver + this.keyDeviceToken, deviceToken);
1225
1230
  }
1226
1231
  setJWT(model) {
1227
1232
  if (!model || model.accessToken?.length === 0) {
1228
- localStorage.removeItem(this.keyJwt);
1233
+ localStorage.removeItem(this.Ver + this.keyJwt);
1229
1234
  return;
1230
1235
  }
1231
- localStorage.setItem(this.keyJwt, JSON.stringify(model));
1236
+ localStorage.setItem(this.Ver + this.keyJwt, JSON.stringify(model));
1232
1237
  }
1233
1238
  getJWT() {
1234
- const token = localStorage.getItem(this.keyJwt);
1239
+ const token = localStorage.getItem(this.Ver + this.keyJwt);
1235
1240
  if (token && token.length > 0) {
1236
1241
  var ret = JSON.parse(token);
1237
- if (!ret || ret.accessToken || ret.accessToken.length == 0)
1242
+ if (!ret || !ret.accessToken || ret.accessToken.length == 0)
1238
1243
  return undefined;
1239
1244
  return ret;
1240
1245
  }
1241
1246
  return undefined;
1242
1247
  }
1243
1248
  removeToken() {
1244
- localStorage.removeItem(this.keyJwt);
1249
+ localStorage.removeItem(this.Ver + this.keyJwt);
1245
1250
  }
1246
1251
  getHeaders() {
1247
1252
  let dateTime = new Date();
@@ -3376,18 +3381,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
3376
3381
  type: Injectable
3377
3382
  }] });
3378
3383
 
3379
- class TokenInfoModelV3 {
3380
- }
3381
-
3382
3384
  class AuthRefreshTokenModel {
3383
3385
  }
3384
3386
 
3385
3387
  class CoreAuthV3Service extends ApiServerBase {
3386
- constructor() {
3387
- super(...arguments);
3388
- this.tokenInfoSubject = new BehaviorSubject(new TokenInfoModelV3);
3389
- this.tokenDeviceSubject = new BehaviorSubject(new TokenDeviceModel);
3390
- }
3388
+ // public tokenInfoSubject: BehaviorSubject<TokenInfoModelV3> = new BehaviorSubject(new TokenInfoModelV3);
3389
+ // public tokenDeviceSubject: BehaviorSubject<TokenDeviceModel> = new BehaviorSubject(new TokenDeviceModel);
3391
3390
  getModuleControllerUrl() {
3392
3391
  return 'auth';
3393
3392
  }
@@ -3424,7 +3423,7 @@ class CoreAuthV3Service extends ApiServerBase {
3424
3423
  })
3425
3424
  .pipe(map((ret) => {
3426
3425
  this.setJWT(null);
3427
- this.tokenInfoSubject.next(new TokenInfoModelV3());
3426
+ //this.tokenInfoSubject.next(new TokenInfoModelV3());
3428
3427
  return ret;
3429
3428
  }));
3430
3429
  }
@@ -3435,31 +3434,31 @@ class CoreAuthV3Service extends ApiServerBase {
3435
3434
  }
3436
3435
  ServiceCurrentToken() {
3437
3436
  return this.http.get(this.getBaseUrl() + this.getModuleControllerUrl() + '/CurrentToken', { headers: this.getHeaders() }).pipe(map((ret) => {
3438
- this.tokenInfoSubject.next(ret.item);
3437
+ //this.tokenInfoSubject.next(ret.item);
3439
3438
  return ret;
3440
3439
  }));
3441
3440
  }
3442
3441
  ServiceGetTokenDevice(model) {
3443
3442
  return this.http.post(this.getBaseUrl() + this.getModuleControllerUrl() + '/GetTokenDevice/', model).pipe(map((ret) => {
3444
3443
  this.setDeviceToken(ret.item.deviceToken);
3445
- if (!ret.item) {
3446
- this.tokenDeviceSubject.next(new TokenDeviceModel());
3447
- }
3448
- else {
3449
- this.tokenDeviceSubject.next(ret.item);
3450
- }
3444
+ // if (!ret.item) {
3445
+ // this.tokenDeviceSubject.next(new TokenDeviceModel());
3446
+ // }
3447
+ // else {
3448
+ // this.tokenDeviceSubject.next(ret.item);
3449
+ // }
3451
3450
  return ret;
3452
3451
  }));
3453
3452
  }
3454
3453
  ServiceCurrentDeviceToken() {
3455
3454
  return this.http.get(this.getBaseUrl() + this.getModuleControllerUrl() + '/CurrentDeviceToken', { headers: this.getHeaders() }).pipe(map((ret) => {
3456
3455
  this.setDeviceToken(ret.item.deviceToken);
3457
- if (!ret.item) {
3458
- this.tokenDeviceSubject.next(new TokenDeviceModel());
3459
- }
3460
- else {
3461
- this.tokenDeviceSubject.next(ret.item);
3462
- }
3456
+ // if (!ret.item) {
3457
+ // this.tokenDeviceSubject.next(new TokenDeviceModel());
3458
+ // }
3459
+ // else {
3460
+ // this.tokenDeviceSubject.next(ret.item);
3461
+ // }
3463
3462
  return ret;
3464
3463
  }));
3465
3464
  }
@@ -3811,6 +3810,9 @@ class CoreTokenActivationModel extends BaseEntity {
3811
3810
  class CoreTokenUserBadLoginModel extends BaseEntity {
3812
3811
  }
3813
3812
 
3813
+ class TokenInfoModelV3 {
3814
+ }
3815
+
3814
3816
  class TokenAccessModel {
3815
3817
  }
3816
3818