coer-elements 1.1.13 → 1.1.14

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.
@@ -1510,220 +1510,387 @@ class Service {
1510
1510
  }
1511
1511
  /** HTTP GET */
1512
1512
  HTTP_GET(request, cancelPrevious = true) {
1513
+ const responseType = request?.responseType || 'json';
1513
1514
  return new Promise(Resolve => {
1514
- let subscription;
1515
1515
  if (cancelPrevious) {
1516
- let subscription = this._GET$;
1517
- this.ReleaseSubscription(subscription);
1518
- }
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) {
1516
+ this.ReleaseSubscription(this._GET$);
1517
+ this._GET$ = this.http.request(new HttpRequest("GET", request.url, {
1518
+ params: request.queryParams,
1519
+ headers: request.headers,
1520
+ responseType: responseType,
1521
+ withCredentials: request.withCredentials
1522
+ })).subscribe({
1523
+ next: (response) => {
1524
+ if (response.type > 0) {
1525
+ Resolve({
1526
+ body: response.body,
1527
+ status: response.status,
1528
+ message: response.statusText,
1529
+ ok: true
1530
+ });
1531
+ }
1532
+ },
1533
+ error: (httpError) => {
1534
+ this.ReleaseSubscription(this._GET$);
1535
+ this.AlertError(httpError, request.alertError);
1527
1536
  Resolve({
1528
- body: response.body,
1529
- status: response.status,
1530
- message: response.statusText,
1531
- ok: true
1537
+ body: {},
1538
+ status: httpError.status,
1539
+ message: httpError.error?.message || httpError.error,
1540
+ ok: false
1532
1541
  });
1542
+ },
1543
+ complete: () => {
1544
+ this.ReleaseSubscription(this._GET$);
1545
+ if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1546
+ this.alert.Success(request.alertSuccess);
1547
+ }
1533
1548
  }
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
+ else {
1552
+ const subscription = this.http.request(new HttpRequest("GET", request.url, {
1553
+ params: request.queryParams,
1554
+ headers: request.headers,
1555
+ responseType: request.responseType,
1556
+ withCredentials: request.withCredentials
1557
+ })).subscribe({
1558
+ next: (response) => {
1559
+ if (response.type > 0) {
1560
+ Resolve({
1561
+ body: response.body,
1562
+ status: response.status,
1563
+ message: response.statusText,
1564
+ ok: true
1565
+ });
1566
+ }
1567
+ },
1568
+ error: (httpError) => {
1569
+ this.ReleaseSubscription(subscription);
1570
+ this.AlertError(httpError, request.alertError);
1571
+ Resolve({
1572
+ body: {},
1573
+ status: httpError.status,
1574
+ message: httpError.error?.message || httpError.error,
1575
+ ok: false
1576
+ });
1577
+ },
1578
+ complete: () => {
1579
+ this.ReleaseSubscription(subscription);
1580
+ if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1581
+ this.alert.Success(request.alertSuccess);
1582
+ }
1549
1583
  }
1550
- }
1551
- });
1584
+ });
1585
+ }
1552
1586
  });
1553
1587
  }
1554
1588
  /** HTTP POST */
1555
1589
  HTTP_POST(request, cancelPrevious = true) {
1556
1590
  return new Promise(Resolve => {
1557
- let subscription;
1591
+ const responseType = request?.responseType || 'json';
1558
1592
  if (cancelPrevious) {
1559
- let subscription = this._POST$;
1560
- this.ReleaseSubscription(subscription);
1561
- }
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) {
1593
+ this.ReleaseSubscription(this._POST$);
1594
+ this._POST$ = this.http.request(new HttpRequest("POST", request.url, request.body, {
1595
+ params: request.queryParams,
1596
+ headers: request.headers,
1597
+ responseType: responseType,
1598
+ withCredentials: request.withCredentials
1599
+ })).subscribe({
1600
+ next: (response) => {
1601
+ if (response.type > 0) {
1602
+ Resolve({
1603
+ body: response.body,
1604
+ status: response.status,
1605
+ message: response.statusText,
1606
+ ok: true
1607
+ });
1608
+ }
1609
+ },
1610
+ error: (httpError) => {
1611
+ this.ReleaseSubscription(this._POST$);
1612
+ this.AlertError(httpError, request.alertError);
1570
1613
  Resolve({
1571
- body: response.body,
1572
- status: response.status,
1573
- message: response.statusText,
1574
- ok: true
1614
+ body: {},
1615
+ status: httpError.status,
1616
+ message: httpError.error?.message || httpError.error,
1617
+ ok: false
1575
1618
  });
1619
+ },
1620
+ complete: () => {
1621
+ this.ReleaseSubscription(this._POST$);
1622
+ if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1623
+ this.alert.Success(request.alertSuccess);
1624
+ }
1576
1625
  }
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);
1626
+ });
1627
+ }
1628
+ else {
1629
+ const subscription = this.http.request(new HttpRequest("POST", request.url, request.body, {
1630
+ params: request.queryParams,
1631
+ headers: request.headers,
1632
+ responseType: responseType,
1633
+ withCredentials: request.withCredentials
1634
+ })).subscribe({
1635
+ next: (response) => {
1636
+ if (response.type > 0) {
1637
+ Resolve({
1638
+ body: response.body,
1639
+ status: response.status,
1640
+ message: response.statusText,
1641
+ ok: true
1642
+ });
1643
+ }
1644
+ },
1645
+ error: (httpError) => {
1646
+ this.ReleaseSubscription(subscription);
1647
+ this.AlertError(httpError, request.alertError);
1648
+ Resolve({
1649
+ body: {},
1650
+ status: httpError.status,
1651
+ message: httpError.error?.message || httpError.error,
1652
+ ok: false
1653
+ });
1654
+ },
1655
+ complete: () => {
1656
+ this.ReleaseSubscription(subscription);
1657
+ if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1658
+ this.alert.Success(request.alertSuccess);
1659
+ }
1592
1660
  }
1593
- }
1594
- });
1661
+ });
1662
+ }
1595
1663
  });
1596
1664
  }
1597
1665
  /** HTTP PUT */
1598
1666
  HTTP_PUT(request, cancelPrevious = true) {
1599
1667
  return new Promise(Resolve => {
1600
- let subscription;
1601
- if (cancelPrevious) {
1602
- let subscription = this._PUT$;
1603
- this.ReleaseSubscription(subscription);
1604
- }
1605
1668
  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) {
1669
+ if (cancelPrevious) {
1670
+ this.ReleaseSubscription(this._PUT$);
1671
+ this._PUT$ = this.http.request(new HttpRequest("PUT", request.url, request.body, {
1672
+ params: request.queryParams,
1673
+ headers: request.headers,
1674
+ responseType: responseType,
1675
+ withCredentials: request.withCredentials
1676
+ })).subscribe({
1677
+ next: (response) => {
1678
+ if (response.type > 0) {
1679
+ Resolve({
1680
+ body: responseType == 'text' ? response.body : {},
1681
+ status: response.status,
1682
+ message: response.statusText,
1683
+ ok: true
1684
+ });
1685
+ }
1686
+ },
1687
+ error: (httpError) => {
1688
+ this.ReleaseSubscription(this._PUT$);
1689
+ this.AlertError(httpError, request.alertError);
1614
1690
  Resolve({
1615
- body: responseType == 'text' ? response.body : {},
1616
- status: response.status,
1617
- message: response.statusText,
1618
- ok: true
1691
+ body: {},
1692
+ status: httpError.status,
1693
+ message: httpError.error?.message || httpError.error,
1694
+ ok: false
1619
1695
  });
1696
+ },
1697
+ complete: () => {
1698
+ this.ReleaseSubscription(this._PUT$);
1699
+ if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1700
+ this.alert.Success(request.alertSuccess, 'Updated', 'fa-solid fa-arrows-rotate fa-spin');
1701
+ }
1620
1702
  }
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');
1703
+ });
1704
+ }
1705
+ else {
1706
+ const subscription = this.http.request(new HttpRequest("PUT", request.url, request.body, {
1707
+ params: request.queryParams,
1708
+ headers: request.headers,
1709
+ responseType: responseType,
1710
+ withCredentials: request.withCredentials
1711
+ })).subscribe({
1712
+ next: (response) => {
1713
+ if (response.type > 0) {
1714
+ Resolve({
1715
+ body: responseType == 'text' ? response.body : {},
1716
+ status: response.status,
1717
+ message: response.statusText,
1718
+ ok: true
1719
+ });
1720
+ }
1721
+ },
1722
+ error: (httpError) => {
1723
+ this.ReleaseSubscription(subscription);
1724
+ this.AlertError(httpError, request.alertError);
1725
+ Resolve({
1726
+ body: {},
1727
+ status: httpError.status,
1728
+ message: httpError.error?.message || httpError.error,
1729
+ ok: false
1730
+ });
1731
+ },
1732
+ complete: () => {
1733
+ this.ReleaseSubscription(subscription);
1734
+ if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1735
+ this.alert.Success(request.alertSuccess, 'Updated', 'fa-solid fa-arrows-rotate fa-spin');
1736
+ }
1636
1737
  }
1637
- }
1638
- });
1738
+ });
1739
+ }
1639
1740
  });
1640
1741
  }
1641
1742
  /** HTTP PATCH */
1642
1743
  HTTP_PATCH(request, cancelPrevious = true) {
1643
1744
  return new Promise(Resolve => {
1644
- let subscription;
1645
- if (cancelPrevious) {
1646
- let subscription = this._PATCH$;
1647
- this.ReleaseSubscription(subscription);
1648
- }
1649
1745
  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) {
1746
+ if (cancelPrevious) {
1747
+ this.ReleaseSubscription(this._PATCH$);
1748
+ this._PATCH$ = this.http.request(new HttpRequest("PATCH", request.url, request.body, {
1749
+ params: request.queryParams,
1750
+ headers: request.headers,
1751
+ responseType: responseType,
1752
+ withCredentials: request.withCredentials
1753
+ })).subscribe({
1754
+ next: (response) => {
1755
+ if (response.type > 0) {
1756
+ Resolve({
1757
+ body: responseType == 'text' ? response.body : {},
1758
+ status: response.status,
1759
+ message: response.statusText,
1760
+ ok: true
1761
+ });
1762
+ }
1763
+ },
1764
+ error: (httpError) => {
1765
+ this.ReleaseSubscription(this._PATCH$);
1766
+ this.AlertError(httpError, request.alertError);
1658
1767
  Resolve({
1659
- body: responseType == 'text' ? response.body : {},
1660
- status: response.status,
1661
- message: response.statusText,
1662
- ok: true
1768
+ body: {},
1769
+ status: httpError.status,
1770
+ message: httpError.error?.message || httpError.error,
1771
+ ok: false
1663
1772
  });
1773
+ },
1774
+ complete: () => {
1775
+ this.ReleaseSubscription(this._PATCH$);
1776
+ if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1777
+ this.alert.Success(request.alertSuccess, 'Updated', 'fa-solid fa-arrows-rotate fa-spin');
1778
+ }
1664
1779
  }
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');
1780
+ });
1781
+ }
1782
+ else {
1783
+ const subscription = this.http.request(new HttpRequest("PATCH", request.url, request.body, {
1784
+ params: request.queryParams,
1785
+ headers: request.headers,
1786
+ responseType: responseType,
1787
+ withCredentials: request.withCredentials
1788
+ })).subscribe({
1789
+ next: (response) => {
1790
+ if (response.type > 0) {
1791
+ Resolve({
1792
+ body: responseType == 'text' ? response.body : {},
1793
+ status: response.status,
1794
+ message: response.statusText,
1795
+ ok: true
1796
+ });
1797
+ }
1798
+ },
1799
+ error: (httpError) => {
1800
+ this.ReleaseSubscription(subscription);
1801
+ this.AlertError(httpError, request.alertError);
1802
+ Resolve({
1803
+ body: {},
1804
+ status: httpError.status,
1805
+ message: httpError.error?.message || httpError.error,
1806
+ ok: false
1807
+ });
1808
+ },
1809
+ complete: () => {
1810
+ this.ReleaseSubscription(subscription);
1811
+ if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1812
+ this.alert.Success(request.alertSuccess, 'Updated', 'fa-solid fa-arrows-rotate fa-spin');
1813
+ }
1680
1814
  }
1681
- }
1682
- });
1815
+ });
1816
+ }
1683
1817
  });
1684
1818
  }
1685
1819
  /** HTTP DELETE */
1686
1820
  HTTP_DELETE(request, cancelPrevious = true) {
1687
1821
  return new Promise(Resolve => {
1688
- let subscription;
1689
- if (cancelPrevious) {
1690
- let subscription = this._DELETE$;
1691
- this.ReleaseSubscription(subscription);
1692
- }
1693
1822
  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) {
1823
+ if (cancelPrevious) {
1824
+ this.ReleaseSubscription(this._DELETE$);
1825
+ this._DELETE$ = this.http.request(new HttpRequest("DELETE", request.url, {
1826
+ params: request.queryParams,
1827
+ headers: request.headers,
1828
+ responseType: responseType,
1829
+ withCredentials: request.withCredentials
1830
+ })).subscribe({
1831
+ next: (response) => {
1832
+ if (response.type > 0) {
1833
+ Resolve({
1834
+ body: responseType == 'text' ? response.body : {},
1835
+ status: response.status,
1836
+ message: response.statusText,
1837
+ ok: true
1838
+ });
1839
+ }
1840
+ },
1841
+ error: (httpError) => {
1842
+ this.ReleaseSubscription(this._DELETE$);
1843
+ this.AlertError(httpError, request.alertError);
1702
1844
  Resolve({
1703
- body: responseType == 'text' ? response.body : {},
1704
- status: response.status,
1705
- message: response.statusText,
1706
- ok: true
1845
+ body: {},
1846
+ status: httpError.status,
1847
+ message: httpError.error?.message || httpError.error,
1848
+ ok: false
1707
1849
  });
1850
+ },
1851
+ complete: () => {
1852
+ this.ReleaseSubscription(this._DELETE$);
1853
+ if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1854
+ this.alert.Success(request.alertSuccess, 'Deleted', 'fa-regular fa-trash-can');
1855
+ }
1708
1856
  }
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');
1857
+ });
1858
+ }
1859
+ else {
1860
+ const subscription = this.http.request(new HttpRequest("DELETE", request.url, {
1861
+ params: request.queryParams,
1862
+ headers: request.headers,
1863
+ responseType: responseType,
1864
+ withCredentials: request.withCredentials
1865
+ })).subscribe({
1866
+ next: (response) => {
1867
+ if (response.type > 0) {
1868
+ Resolve({
1869
+ body: responseType == 'text' ? response.body : {},
1870
+ status: response.status,
1871
+ message: response.statusText,
1872
+ ok: true
1873
+ });
1874
+ }
1875
+ },
1876
+ error: (httpError) => {
1877
+ this.ReleaseSubscription(subscription);
1878
+ this.AlertError(httpError, request.alertError);
1879
+ Resolve({
1880
+ body: {},
1881
+ status: httpError.status,
1882
+ message: httpError.error?.message || httpError.error,
1883
+ ok: false
1884
+ });
1885
+ },
1886
+ complete: () => {
1887
+ this.ReleaseSubscription(subscription);
1888
+ if (Tools.IsNotOnlyWhiteSpace(request.alertSuccess)) {
1889
+ this.alert.Success(request.alertSuccess, 'Deleted', 'fa-regular fa-trash-can');
1890
+ }
1724
1891
  }
1725
- }
1726
- });
1892
+ });
1893
+ }
1727
1894
  });
1728
1895
  }
1729
1896
  /** */