@flusys/ng-shared 5.3.1 → 5.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.
|
@@ -82,7 +82,9 @@ const SHARED_MESSAGES = {
|
|
|
82
82
|
'error.validation': 'Validation failed',
|
|
83
83
|
'error.unauthorized': 'Unauthorized access',
|
|
84
84
|
'error.forbidden': 'Access forbidden',
|
|
85
|
-
'error.conflict': '
|
|
85
|
+
'error.conflict': '{{entity}} with this {{field}} already exists',
|
|
86
|
+
'error.db.foreign.key': "Invalid reference for '{{field}}'",
|
|
87
|
+
'error.db.not.null': "Required field '{{field}}' cannot be null",
|
|
86
88
|
'error.internal': 'Internal server error',
|
|
87
89
|
'error.service.unavailable': 'Service temporarily unavailable',
|
|
88
90
|
'error.unknown': 'Unknown error occurred',
|
|
@@ -1513,10 +1515,24 @@ class ApiResourceService {
|
|
|
1513
1515
|
listResource;
|
|
1514
1516
|
// ── Derived/computed signals (pure reads, no side-effects) ────────────────
|
|
1515
1517
|
isLoading = computed(() => this.listResource.isLoading(), ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
|
|
1516
|
-
data = computed(() =>
|
|
1517
|
-
|
|
1518
|
-
|
|
1518
|
+
data = computed(() => {
|
|
1519
|
+
if (this.listResource.error())
|
|
1520
|
+
return [];
|
|
1521
|
+
return this.listResource.value()?.data ?? [];
|
|
1522
|
+
}, ...(ngDevMode ? [{ debugName: "data" }] : []));
|
|
1523
|
+
total = computed(() => {
|
|
1524
|
+
if (this.listResource.error())
|
|
1525
|
+
return 0;
|
|
1526
|
+
return this.listResource.value()?.meta?.total ?? 0;
|
|
1527
|
+
}, ...(ngDevMode ? [{ debugName: "total" }] : []));
|
|
1528
|
+
pageInfo = computed(() => {
|
|
1529
|
+
if (this.listResource.error())
|
|
1530
|
+
return undefined;
|
|
1531
|
+
return this.listResource.value()?.meta;
|
|
1532
|
+
}, ...(ngDevMode ? [{ debugName: "pageInfo" }] : []));
|
|
1519
1533
|
hasMore = computed(() => {
|
|
1534
|
+
if (this.listResource.error())
|
|
1535
|
+
return false;
|
|
1520
1536
|
const meta = this.listResource.value()?.meta;
|
|
1521
1537
|
if (!meta)
|
|
1522
1538
|
return false;
|