ng-ipa-library 1.4.0 → 1.4.1
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/esm2020/lib/core/interceptors/error.interceptor.mjs +24 -3
- package/fesm2015/ng-ipa-library.mjs +23 -2
- package/fesm2015/ng-ipa-library.mjs.map +1 -1
- package/fesm2020/ng-ipa-library.mjs +23 -2
- package/fesm2020/ng-ipa-library.mjs.map +1 -1
- package/lib/core/interceptors/error.interceptor.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1337,13 +1337,19 @@ class ErrorInterceptor {
|
|
|
1337
1337
|
const response = error.error;
|
|
1338
1338
|
const toastrConfig = {
|
|
1339
1339
|
disableTimeOut: true,
|
|
1340
|
+
closeButton: true,
|
|
1341
|
+
tapToDismiss: false,
|
|
1340
1342
|
};
|
|
1341
1343
|
switch (response.statusCode) {
|
|
1342
1344
|
case 500:
|
|
1343
|
-
|
|
1345
|
+
const message = response?.innerException + ' ' + response?.stackTrace;
|
|
1346
|
+
const toastr = this.toastrService.error(message, response.message, toastrConfig);
|
|
1347
|
+
toastr.onShown.subscribe(() => {
|
|
1348
|
+
this.addCopyButton(message);
|
|
1349
|
+
});
|
|
1344
1350
|
break;
|
|
1345
1351
|
default:
|
|
1346
|
-
this.toastrService.error(response.message,
|
|
1352
|
+
this.toastrService.error('', response.message, toastrConfig);
|
|
1347
1353
|
break;
|
|
1348
1354
|
}
|
|
1349
1355
|
return throwError(error);
|
|
@@ -1357,6 +1363,21 @@ class ErrorInterceptor {
|
|
|
1357
1363
|
}
|
|
1358
1364
|
return false;
|
|
1359
1365
|
}
|
|
1366
|
+
addCopyButton(message) {
|
|
1367
|
+
const messageToast = document.getElementsByClassName('toast-message')[0];
|
|
1368
|
+
const icon = document.createElement('i');
|
|
1369
|
+
icon.classList.add('ms-2', 'fas', 'fa-copy');
|
|
1370
|
+
icon.addEventListener('click', () => {
|
|
1371
|
+
this.copyToClipboard(message);
|
|
1372
|
+
});
|
|
1373
|
+
messageToast.appendChild(icon);
|
|
1374
|
+
}
|
|
1375
|
+
copyToClipboard(message) {
|
|
1376
|
+
navigator.clipboard.writeText(message);
|
|
1377
|
+
this.toastrService.success('تم نسخ الرسالة إلى الحافظة', '', {
|
|
1378
|
+
positionClass: 'toast-bottom-right',
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1360
1381
|
}
|
|
1361
1382
|
ErrorInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorInterceptor, deps: [{ token: ErrorService }, { token: i1.ToastrService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1362
1383
|
ErrorInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorInterceptor });
|