coer-elements 1.1.10 → 1.1.12

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.
@@ -1 +1 @@
1
- {"version":3,"file":"coer-elements-services.mjs","sources":["../../../projects/coer-elements/services/lib/jwt.service.ts","../../../projects/coer-elements/services/lib/services.module.ts","../../../projects/coer-elements/services/coer-elements-services.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\r\nimport { JwtHelperService } from '@auth0/angular-jwt';\r\nimport { DateTime, Tools, User } from 'coer-elements/tools'; \r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class JWTService {\r\n\r\n private readonly jwtService = inject(JwtHelperService);\r\n \r\n \r\n /** */\r\n public get jwt(): string {\r\n return User.Get<any>()?.jwt || '';\r\n }\r\n\r\n \r\n /** */\r\n public get expirationDate(): string | null { \r\n return Tools.IsNotOnlyWhiteSpace(this.jwt) && Tools.IsNotNull(this.jwtService.getTokenExpirationDate(this.jwt))\r\n ? DateTime.GetFormatDB(this.jwtService.getTokenExpirationDate(this.jwt)!)\r\n : null\r\n }\r\n\r\n\r\n /** */\r\n public get isExpired(): boolean { \r\n return Tools.IsNotOnlyWhiteSpace(this.jwt)\r\n ? this.jwtService.isTokenExpired(this.jwt)\r\n : true\r\n }\r\n}","import { NgModule } from '@angular/core'; \r\n\r\n//Services\r\nimport { JWTService } from './jwt.service';\r\n\r\n@NgModule({ \r\n providers: [ \r\n JWTService \r\n ]\r\n})\r\nexport class ServicesModule { }","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAOa,UAAU,CAAA;AAHvB,IAAA,WAAA,GAAA;AAKqB,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAuBzD;;AAnBG,IAAA,IAAW,GAAG,GAAA;QACV,OAAO,IAAI,CAAC,GAAG,EAAO,EAAE,GAAG,IAAI,EAAE;;;AAKrC,IAAA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CAAA,CAAA;;2FAEQ,cAAc,EAAA,UAAA,EAAA,CAAA;kBAL1B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,SAAS,EAAE;wBACP;AACH;AACJ,iBAAA;;;ACTD;;AAEG;;;;"}
1
+ {"version":3,"file":"coer-elements-services.mjs","sources":["../../../projects/coer-elements/services/lib/jwt.service.ts","../../../projects/coer-elements/services/lib/services.module.ts","../../../projects/coer-elements/services/coer-elements-services.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\r\nimport { JwtHelperService } from '@auth0/angular-jwt';\r\nimport { DateTime, Tools, User } from 'coer-elements/tools'; \r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class JWTService {\r\n\r\n private readonly jwtService = inject(JwtHelperService);\r\n \r\n \r\n /** */\r\n public get jwt(): string { \r\n return User.Get<any>()?.jwt || '';\r\n }\r\n\r\n \r\n /** */\r\n public get expirationDate(): string | null { \r\n return Tools.IsNotOnlyWhiteSpace(this.jwt) && Tools.IsNotNull(this.jwtService.getTokenExpirationDate(this.jwt))\r\n ? DateTime.GetFormatDB(this.jwtService.getTokenExpirationDate(this.jwt)!)\r\n : null\r\n }\r\n\r\n\r\n /** */\r\n public get isExpired(): boolean { \r\n return Tools.IsNotOnlyWhiteSpace(this.jwt)\r\n ? this.jwtService.isTokenExpired(this.jwt)\r\n : true\r\n }\r\n}","import { NgModule } from '@angular/core'; \r\n\r\n//Services\r\nimport { JWTService } from './jwt.service';\r\n\r\n@NgModule({ \r\n providers: [ \r\n JWTService \r\n ]\r\n})\r\nexport class ServicesModule { }","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAOa,UAAU,CAAA;AAHvB,IAAA,WAAA,GAAA;AAKqB,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAuBzD;;AAnBG,IAAA,IAAW,GAAG,GAAA;QACV,OAAO,IAAI,CAAC,GA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,cAAc,EAJZ,SAAA,EAAA;YACP;AACH,SAAA,EAAA,CAAA,CAAA;;2FAEQ,cAAc,EAAA,UAAA,EAAA,CAAA;kBAL1B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,SAAS,EAAE;wBACP;AACH;AACJ,iBAAA;;;ACTD;;AAEG;;;;"}
@@ -1511,381 +1511,219 @@ class Service {
1511
1511
  /** HTTP GET */
1512
1512
  HTTP_GET(request, cancelPrevious = true) {
1513
1513
  return new Promise(Resolve => {
1514
+ let subscription;
1514
1515
  if (cancelPrevious) {
1515
- this.ReleaseSubscription(this._GET$);
1516
- this._GET$ = this.http.request(new HttpRequest("GET", request.url, {
1517
- params: request.queryParams,
1518
- headers: request.headers,
1519
- responseType: request.responseType,
1520
- withCredentials: request.withCredentials
1521
- })).subscribe({
1522
- next: (response) => {
1523
- if (response.type > 0) {
1524
- Resolve({
1525
- body: response.body,
1526
- status: response.status,
1527
- message: response.statusText,
1528
- ok: true
1529
- });
1530
- }
1531
- },
1532
- error: (httpError) => {
1533
- this.ReleaseSubscription(this._GET$);
1534
- this.AlertError(httpError, request.alertError);
1535
- Resolve({
1536
- body: {},
1537
- status: httpError.status,
1538
- message: httpError.error?.message || httpError.error,
1539
- ok: false
1540
- });
1541
- },
1542
- complete: () => {
1543
- this.ReleaseSubscription(this._GET$);
1544
- if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1545
- this.alert.Success(request.alertSuccess);
1546
- }
1547
- }
1548
- });
1516
+ let subscription = this._GET$;
1517
+ this.ReleaseSubscription(subscription);
1549
1518
  }
1550
- else {
1551
- const subscription = this.http.request(new HttpRequest("GET", request.url, {
1552
- params: request.queryParams,
1553
- headers: request.headers,
1554
- responseType: request.responseType,
1555
- withCredentials: request.withCredentials
1556
- })).subscribe({
1557
- next: (response) => {
1558
- if (response.type > 0) {
1559
- Resolve({
1560
- body: response.body,
1561
- status: response.status,
1562
- message: response.statusText,
1563
- ok: true
1564
- });
1565
- }
1566
- },
1567
- error: (httpError) => {
1568
- this.ReleaseSubscription(subscription);
1569
- this.AlertError(httpError, request.alertError);
1519
+ subscription = this.http.request(new HttpRequest("GET", request.url, {
1520
+ params: request.queryParams,
1521
+ headers: request.headers,
1522
+ responseType: request?.responseType || 'json',
1523
+ withCredentials: request.withCredentials
1524
+ })).subscribe({
1525
+ next: (response) => {
1526
+ if (response.type > 0) {
1570
1527
  Resolve({
1571
- body: {},
1572
- status: httpError.status,
1573
- message: httpError.error?.message || httpError.error,
1574
- ok: false
1528
+ body: response.body,
1529
+ status: response.status,
1530
+ message: response.statusText,
1531
+ ok: true
1575
1532
  });
1576
- },
1577
- complete: () => {
1578
- this.ReleaseSubscription(subscription);
1579
- if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1580
- this.alert.Success(request.alertSuccess);
1581
- }
1582
1533
  }
1583
- });
1584
- }
1534
+ },
1535
+ error: (httpError) => {
1536
+ this.ReleaseSubscription(subscription);
1537
+ this.AlertError(httpError, request.alertError);
1538
+ Resolve({
1539
+ body: {},
1540
+ status: httpError.status,
1541
+ message: httpError.error?.message || httpError.error,
1542
+ ok: false
1543
+ });
1544
+ },
1545
+ complete: () => {
1546
+ this.ReleaseSubscription(subscription);
1547
+ if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1548
+ this.alert.Success(request.alertSuccess);
1549
+ }
1550
+ }
1551
+ });
1585
1552
  });
1586
1553
  }
1587
1554
  /** HTTP POST */
1588
1555
  HTTP_POST(request, cancelPrevious = true) {
1589
1556
  return new Promise(Resolve => {
1557
+ let subscription;
1590
1558
  if (cancelPrevious) {
1591
- this.ReleaseSubscription(this._POST$);
1592
- this._POST$ = this.http.request(new HttpRequest("POST", request.url, request.body, {
1593
- params: request.queryParams,
1594
- headers: request.headers,
1595
- responseType: request.responseType,
1596
- withCredentials: request.withCredentials
1597
- })).subscribe({
1598
- next: (response) => {
1599
- if (response.type > 0) {
1600
- Resolve({
1601
- body: response.body,
1602
- status: response.status,
1603
- message: response.statusText,
1604
- ok: true
1605
- });
1606
- }
1607
- },
1608
- error: (httpError) => {
1609
- this.ReleaseSubscription(this._POST$);
1610
- this.AlertError(httpError, request.alertError);
1611
- Resolve({
1612
- body: {},
1613
- status: httpError.status,
1614
- message: httpError.error?.message || httpError.error,
1615
- ok: false
1616
- });
1617
- },
1618
- complete: () => {
1619
- this.ReleaseSubscription(this._POST$);
1620
- if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1621
- this.alert.Success(request.alertSuccess);
1622
- }
1623
- }
1624
- });
1559
+ let subscription = this._POST$;
1560
+ this.ReleaseSubscription(subscription);
1625
1561
  }
1626
- else {
1627
- const subscription = this.http.request(new HttpRequest("POST", request.url, request.body, {
1628
- params: request.queryParams,
1629
- headers: request.headers,
1630
- responseType: request.responseType,
1631
- withCredentials: request.withCredentials
1632
- })).subscribe({
1633
- next: (response) => {
1634
- if (response.type > 0) {
1635
- Resolve({
1636
- body: response.body,
1637
- status: response.status,
1638
- message: response.statusText,
1639
- ok: true
1640
- });
1641
- }
1642
- },
1643
- error: (httpError) => {
1644
- this.ReleaseSubscription(subscription);
1645
- this.AlertError(httpError, request.alertError);
1562
+ subscription = this.http.request(new HttpRequest("POST", request.url, request.body, {
1563
+ params: request.queryParams,
1564
+ headers: request.headers,
1565
+ responseType: request?.responseType || 'json',
1566
+ withCredentials: request.withCredentials
1567
+ })).subscribe({
1568
+ next: (response) => {
1569
+ if (response.type > 0) {
1646
1570
  Resolve({
1647
- body: {},
1648
- status: httpError.status,
1649
- message: httpError.error?.message || httpError.error,
1650
- ok: false
1571
+ body: response.body,
1572
+ status: response.status,
1573
+ message: response.statusText,
1574
+ ok: true
1651
1575
  });
1652
- },
1653
- complete: () => {
1654
- this.ReleaseSubscription(subscription);
1655
- if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1656
- this.alert.Success(request.alertSuccess);
1657
- }
1658
1576
  }
1659
- });
1660
- }
1577
+ },
1578
+ error: (httpError) => {
1579
+ this.ReleaseSubscription(subscription);
1580
+ this.AlertError(httpError, request.alertError);
1581
+ Resolve({
1582
+ body: {},
1583
+ status: httpError.status,
1584
+ message: httpError.error?.message || httpError.error,
1585
+ ok: false
1586
+ });
1587
+ },
1588
+ complete: () => {
1589
+ this.ReleaseSubscription(subscription);
1590
+ if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1591
+ this.alert.Success(request.alertSuccess);
1592
+ }
1593
+ }
1594
+ });
1661
1595
  });
1662
1596
  }
1663
1597
  /** HTTP PUT */
1664
1598
  HTTP_PUT(request, cancelPrevious = true) {
1665
1599
  return new Promise(Resolve => {
1600
+ let subscription;
1666
1601
  if (cancelPrevious) {
1667
- this.ReleaseSubscription(this._PUT$);
1668
- this._PUT$ = this.http.request(new HttpRequest("PUT", request.url, request.body, {
1669
- params: request.queryParams,
1670
- headers: request.headers,
1671
- responseType: request.responseType,
1672
- withCredentials: request.withCredentials
1673
- })).subscribe({
1674
- next: (response) => {
1675
- if (response.type > 0) {
1676
- Resolve({
1677
- body: {},
1678
- status: response.status,
1679
- message: response.statusText,
1680
- ok: true
1681
- });
1682
- }
1683
- },
1684
- error: (httpError) => {
1685
- this.ReleaseSubscription(this._PUT$);
1686
- this.AlertError(httpError, request.alertError);
1687
- Resolve({
1688
- body: {},
1689
- status: httpError.status,
1690
- message: httpError.error?.message || httpError.error,
1691
- ok: false
1692
- });
1693
- },
1694
- complete: () => {
1695
- this.ReleaseSubscription(this._PUT$);
1696
- if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1697
- this.alert.Success(request.alertSuccess, 'Updated', 'fa-solid fa-arrows-rotate fa-spin');
1698
- }
1699
- }
1700
- });
1602
+ let subscription = this._PUT$;
1603
+ this.ReleaseSubscription(subscription);
1701
1604
  }
1702
- else {
1703
- const subscription = this.http.request(new HttpRequest("PUT", request.url, request.body, {
1704
- params: request.queryParams,
1705
- headers: request.headers,
1706
- responseType: request.responseType,
1707
- withCredentials: request.withCredentials
1708
- })).subscribe({
1709
- next: (response) => {
1710
- if (response.type > 0) {
1711
- Resolve({
1712
- body: {},
1713
- status: response.status,
1714
- message: response.statusText,
1715
- ok: true
1716
- });
1717
- }
1718
- },
1719
- error: (httpError) => {
1720
- this.ReleaseSubscription(subscription);
1721
- this.AlertError(httpError, request.alertError);
1605
+ const responseType = request?.responseType || 'json';
1606
+ subscription = this.http.request(new HttpRequest("PUT", request.url, request.body, {
1607
+ params: request.queryParams,
1608
+ headers: request.headers,
1609
+ responseType: responseType,
1610
+ withCredentials: request.withCredentials
1611
+ })).subscribe({
1612
+ next: (response) => {
1613
+ if (response.type > 0) {
1722
1614
  Resolve({
1723
- body: {},
1724
- status: httpError.status,
1725
- message: httpError.error?.message || httpError.error,
1726
- ok: false
1615
+ body: responseType == 'text' ? response.body : {},
1616
+ status: response.status,
1617
+ message: response.statusText,
1618
+ ok: true
1727
1619
  });
1728
- },
1729
- complete: () => {
1730
- this.ReleaseSubscription(subscription);
1731
- if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1732
- this.alert.Success(request.alertSuccess, 'Updated', 'fa-solid fa-arrows-rotate fa-spin');
1733
- }
1734
1620
  }
1735
- });
1736
- }
1621
+ },
1622
+ error: (httpError) => {
1623
+ this.ReleaseSubscription(subscription);
1624
+ this.AlertError(httpError, request.alertError);
1625
+ Resolve({
1626
+ body: {},
1627
+ status: httpError.status,
1628
+ message: httpError.error?.message || httpError.error,
1629
+ ok: false
1630
+ });
1631
+ },
1632
+ complete: () => {
1633
+ this.ReleaseSubscription(subscription);
1634
+ if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1635
+ this.alert.Success(request.alertSuccess, 'Updated', 'fa-solid fa-arrows-rotate fa-spin');
1636
+ }
1637
+ }
1638
+ });
1737
1639
  });
1738
1640
  }
1739
1641
  /** HTTP PATCH */
1740
1642
  HTTP_PATCH(request, cancelPrevious = true) {
1741
1643
  return new Promise(Resolve => {
1644
+ let subscription;
1742
1645
  if (cancelPrevious) {
1743
- this.ReleaseSubscription(this._PATCH$);
1744
- this._PATCH$ = this.http.request(new HttpRequest("PATCH", request.url, request.body, {
1745
- params: request.queryParams,
1746
- headers: request.headers,
1747
- responseType: request.responseType,
1748
- withCredentials: request.withCredentials
1749
- })).subscribe({
1750
- next: (response) => {
1751
- if (response.type > 0) {
1752
- Resolve({
1753
- body: {},
1754
- status: response.status,
1755
- message: response.statusText,
1756
- ok: true
1757
- });
1758
- }
1759
- },
1760
- error: (httpError) => {
1761
- this.ReleaseSubscription(this._PATCH$);
1762
- this.AlertError(httpError, request.alertError);
1763
- Resolve({
1764
- body: {},
1765
- status: httpError.status,
1766
- message: httpError.error?.message || httpError.error,
1767
- ok: false
1768
- });
1769
- },
1770
- complete: () => {
1771
- this.ReleaseSubscription(this._PATCH$);
1772
- if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1773
- this.alert.Success(request.alertSuccess, 'Updated', 'fa-solid fa-arrows-rotate fa-spin');
1774
- }
1775
- }
1776
- });
1646
+ let subscription = this._PATCH$;
1647
+ this.ReleaseSubscription(subscription);
1777
1648
  }
1778
- else {
1779
- const subscription = this.http.request(new HttpRequest("PATCH", request.url, request.body, {
1780
- params: request.queryParams,
1781
- headers: request.headers,
1782
- responseType: request.responseType,
1783
- withCredentials: request.withCredentials
1784
- })).subscribe({
1785
- next: (response) => {
1786
- if (response.type > 0) {
1787
- Resolve({
1788
- body: {},
1789
- status: response.status,
1790
- message: response.statusText,
1791
- ok: true
1792
- });
1793
- }
1794
- },
1795
- error: (httpError) => {
1796
- this.ReleaseSubscription(subscription);
1797
- this.AlertError(httpError, request.alertError);
1649
+ const responseType = request?.responseType || 'json';
1650
+ subscription = this.http.request(new HttpRequest("PATCH", request.url, request.body, {
1651
+ params: request.queryParams,
1652
+ headers: request.headers,
1653
+ responseType: responseType,
1654
+ withCredentials: request.withCredentials
1655
+ })).subscribe({
1656
+ next: (response) => {
1657
+ if (response.type > 0) {
1798
1658
  Resolve({
1799
- body: {},
1800
- status: httpError.status,
1801
- message: httpError.error?.message || httpError.error,
1802
- ok: false
1659
+ body: responseType == 'text' ? response.body : {},
1660
+ status: response.status,
1661
+ message: response.statusText,
1662
+ ok: true
1803
1663
  });
1804
- },
1805
- complete: () => {
1806
- this.ReleaseSubscription(subscription);
1807
- if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1808
- this.alert.Success(request.alertSuccess, 'Updated', 'fa-solid fa-arrows-rotate fa-spin');
1809
- }
1810
1664
  }
1811
- });
1812
- }
1665
+ },
1666
+ error: (httpError) => {
1667
+ this.ReleaseSubscription(subscription);
1668
+ this.AlertError(httpError, request.alertError);
1669
+ Resolve({
1670
+ body: {},
1671
+ status: httpError.status,
1672
+ message: httpError.error?.message || httpError.error,
1673
+ ok: false
1674
+ });
1675
+ },
1676
+ complete: () => {
1677
+ this.ReleaseSubscription(subscription);
1678
+ if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1679
+ this.alert.Success(request.alertSuccess, 'Updated', 'fa-solid fa-arrows-rotate fa-spin');
1680
+ }
1681
+ }
1682
+ });
1813
1683
  });
1814
1684
  }
1815
1685
  /** HTTP DELETE */
1816
1686
  HTTP_DELETE(request, cancelPrevious = true) {
1817
1687
  return new Promise(Resolve => {
1688
+ let subscription;
1818
1689
  if (cancelPrevious) {
1819
- this.ReleaseSubscription(this._DELETE$);
1820
- this._DELETE$ = this.http.request(new HttpRequest("DELETE", request.url, {
1821
- params: request.queryParams,
1822
- headers: request.headers,
1823
- responseType: request.responseType,
1824
- withCredentials: request.withCredentials
1825
- })).subscribe({
1826
- next: (response) => {
1827
- if (response.type > 0) {
1828
- Resolve({
1829
- body: {},
1830
- status: response.status,
1831
- message: response.statusText,
1832
- ok: true
1833
- });
1834
- }
1835
- },
1836
- error: (httpError) => {
1837
- this.ReleaseSubscription(this._DELETE$);
1838
- this.AlertError(httpError, request.alertError);
1839
- Resolve({
1840
- body: {},
1841
- status: httpError.status,
1842
- message: httpError.error?.message || httpError.error,
1843
- ok: false
1844
- });
1845
- },
1846
- complete: () => {
1847
- this.ReleaseSubscription(this._DELETE$);
1848
- if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1849
- this.alert.Success(request.alertSuccess, 'Deleted', 'fa-regular fa-trash-can');
1850
- }
1851
- }
1852
- });
1690
+ let subscription = this._DELETE$;
1691
+ this.ReleaseSubscription(subscription);
1853
1692
  }
1854
- else {
1855
- const subscription = this.http.request(new HttpRequest("DELETE", request.url, {
1856
- params: request.queryParams,
1857
- headers: request.headers,
1858
- responseType: request.responseType,
1859
- withCredentials: request.withCredentials
1860
- })).subscribe({
1861
- next: (response) => {
1862
- if (response.type > 0) {
1863
- Resolve({
1864
- body: {},
1865
- status: response.status,
1866
- message: response.statusText,
1867
- ok: true
1868
- });
1869
- }
1870
- },
1871
- error: (httpError) => {
1872
- this.ReleaseSubscription(subscription);
1873
- this.AlertError(httpError, request.alertError);
1693
+ const responseType = request?.responseType || 'json';
1694
+ subscription = this.http.request(new HttpRequest("DELETE", request.url, {
1695
+ params: request.queryParams,
1696
+ headers: request.headers,
1697
+ responseType: responseType,
1698
+ withCredentials: request.withCredentials
1699
+ })).subscribe({
1700
+ next: (response) => {
1701
+ if (response.type > 0) {
1874
1702
  Resolve({
1875
- body: {},
1876
- status: httpError.status,
1877
- message: httpError.error?.message || httpError.error,
1878
- ok: false
1703
+ body: responseType == 'text' ? response.body : {},
1704
+ status: response.status,
1705
+ message: response.statusText,
1706
+ ok: true
1879
1707
  });
1880
- },
1881
- complete: () => {
1882
- this.ReleaseSubscription(subscription);
1883
- if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1884
- this.alert.Success(request.alertSuccess, 'Deleted', 'fa-regular fa-trash-can');
1885
- }
1886
1708
  }
1887
- });
1888
- }
1709
+ },
1710
+ error: (httpError) => {
1711
+ this.ReleaseSubscription(subscription);
1712
+ this.AlertError(httpError, request.alertError);
1713
+ Resolve({
1714
+ body: {},
1715
+ status: httpError.status,
1716
+ message: httpError.error?.message || httpError.error,
1717
+ ok: false
1718
+ });
1719
+ },
1720
+ complete: () => {
1721
+ this.ReleaseSubscription(subscription);
1722
+ if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1723
+ this.alert.Success(request.alertSuccess, 'Deleted', 'fa-regular fa-trash-can');
1724
+ }
1725
+ }
1726
+ });
1889
1727
  });
1890
1728
  }
1891
1729
  /** */