fix: remove unused header total calculation in getCollectionTotalItems function and delete non-sense authHeaders const (maintaining headers const to resusability)

This commit is contained in:
Dayv1dDev
2026-07-09 13:09:19 +02:00
parent 9e6d9d3684
commit 8a6f35c831
+1 -6
View File
@@ -101,10 +101,6 @@
function getCollectionTotalItems(collection: unknown, response?: Response): number {
if (Array.isArray(collection)) {
const headerTotal =
response?.headers.get("X-Total-Items") ??
response?.headers.get("Content-Range")?.split("/")[1];
if (headerTotal) return Number(headerTotal);
return collection.length;
}
if (!collection || typeof collection !== "object") return 0;
@@ -220,11 +216,10 @@
let items = Number($itemsPerPage);
const query = buildChargesQuery(filters, page, items);
const authHeaders = $session?.token.asHttpHeaders as Record<string, string> | undefined;
const headers = {
Accept: "application/ld+json",
...(authHeaders ?? {}),
...($session?.token.asHttpHeaders ?? {}),
};
const {