ng-ipa-library 1.3.12 → 1.4.0

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.
@@ -1423,16 +1423,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
1423
1423
  }]
1424
1424
  }], ctorParameters: function () { return []; } });
1425
1425
 
1426
+ class TokenService {
1427
+ constructor() {
1428
+ this.urls = [];
1429
+ }
1430
+ setExceptionUrls(urls) {
1431
+ this.urls = urls;
1432
+ }
1433
+ addExceptionUrl(url) {
1434
+ this.urls.push(url);
1435
+ }
1436
+ }
1437
+ TokenService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TokenService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1438
+ TokenService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TokenService, providedIn: 'root' });
1439
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TokenService, decorators: [{
1440
+ type: Injectable,
1441
+ args: [{
1442
+ providedIn: 'root',
1443
+ }]
1444
+ }], ctorParameters: function () { return []; } });
1445
+
1426
1446
  class TokenInterceptor {
1427
- constructor(authService, http, loaderService) {
1447
+ constructor(authService, http, loaderService, tokenService) {
1428
1448
  this.authService = authService;
1429
1449
  this.http = http;
1430
1450
  this.loaderService = loaderService;
1451
+ this.tokenService = tokenService;
1431
1452
  this.refresh = true;
1432
1453
  this.loaderService.addExceptionUrl({
1433
1454
  path: '/api/users?refresh',
1434
1455
  method: 'GET',
1435
1456
  });
1457
+ this.tokenService.addExceptionUrl({
1458
+ path: '/api/users?refresh',
1459
+ method: 'GET',
1460
+ });
1436
1461
  }
1437
1462
  intercept(request, next) {
1438
1463
  if (this.isException(request)) {
@@ -1478,19 +1503,20 @@ class TokenInterceptor {
1478
1503
  }
1479
1504
  }
1480
1505
  }
1481
- isException(request) {
1482
- if (request.url.includes('/api/users?refresh') &&
1483
- request.method === 'GET') {
1484
- return true;
1506
+ isException(req) {
1507
+ for (const url of this.tokenService.urls) {
1508
+ if (req.url.includes(url.path) && req.method === url.method) {
1509
+ return true;
1510
+ }
1485
1511
  }
1486
1512
  return false;
1487
1513
  }
1488
1514
  }
1489
- TokenInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TokenInterceptor, deps: [{ token: AuthService }, { token: i2$4.HttpClient }, { token: LoaderService }], target: i0.ɵɵFactoryTarget.Injectable });
1515
+ TokenInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TokenInterceptor, deps: [{ token: AuthService }, { token: i2$4.HttpClient }, { token: LoaderService }, { token: TokenService }], target: i0.ɵɵFactoryTarget.Injectable });
1490
1516
  TokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TokenInterceptor });
1491
1517
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TokenInterceptor, decorators: [{
1492
1518
  type: Injectable
1493
- }], ctorParameters: function () { return [{ type: AuthService }, { type: i2$4.HttpClient }, { type: LoaderService }]; } });
1519
+ }], ctorParameters: function () { return [{ type: AuthService }, { type: i2$4.HttpClient }, { type: LoaderService }, { type: TokenService }]; } });
1494
1520
 
1495
1521
  class myIPATokenInterceptor {
1496
1522
  constructor(authService) {
@@ -1732,5 +1758,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
1732
1758
  * Generated bundle index. Do not edit.
1733
1759
  */
1734
1760
 
1735
- export { AuthService, BreadcrumbsService, CommonService, DropdownInputComponent, ErrorInterceptor, ErrorService, FileUploadComponent, GenerateFormComponent, GregorianDatepickerComponent, HijriDatePipe, HijriDatepickerComponent, IPAFormService, LoaderComponent, LoaderService, LoadingInterceptor, NgIPALibraryModule, PipesModule, RecaptchaComponent, ShareButtonComponent, ShareButtonModule, TextInputComponent, TextareaInputComponent, TokenInterceptor, myIPATokenInterceptor };
1761
+ export { AuthService, BreadcrumbsService, CommonService, DropdownInputComponent, ErrorInterceptor, ErrorService, FileUploadComponent, GenerateFormComponent, GregorianDatepickerComponent, HijriDatePipe, HijriDatepickerComponent, IPAFormService, LoaderComponent, LoaderService, LoadingInterceptor, NgIPALibraryModule, PipesModule, RecaptchaComponent, ShareButtonComponent, ShareButtonModule, TextInputComponent, TextareaInputComponent, TokenInterceptor, TokenService, myIPATokenInterceptor };
1736
1762
  //# sourceMappingURL=ng-ipa-library.mjs.map