mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-07-16 17:33:00 +01:00
fix: add return type
This commit is contained in:
@@ -66,7 +66,7 @@ export async function fetchAndStoreRecentlyAdded(
|
|||||||
userId: string,
|
userId: string,
|
||||||
basePath: string,
|
basePath: string,
|
||||||
token: string
|
token: string
|
||||||
) {
|
): Promise<number> {
|
||||||
try {
|
try {
|
||||||
const deviceName = await getDeviceName();
|
const deviceName = await getDeviceName();
|
||||||
const id = getOrSetDeviceId();
|
const id = getOrSetDeviceId();
|
||||||
@@ -153,7 +153,7 @@ export async function fetchAndStoreRecentlyAdded(
|
|||||||
RECENTLY_ADDED_SENT_NOTIFICATIONS_ITEM_IDS_KEY,
|
RECENTLY_ADDED_SENT_NOTIFICATIONS_ITEM_IDS_KEY,
|
||||||
JSON.stringify(items.map((item) => item.Id))
|
JSON.stringify(items.map((item) => item.Id))
|
||||||
);
|
);
|
||||||
return;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
// Only send notifications for items that haven't been sent yet
|
// Only send notifications for items that haven't been sent yet
|
||||||
for (const newItem of items) {
|
for (const newItem of items) {
|
||||||
@@ -176,8 +176,12 @@ export async function fetchAndStoreRecentlyAdded(
|
|||||||
RECENTLY_ADDED_SENT_NOTIFICATIONS_ITEM_IDS_KEY,
|
RECENTLY_ADDED_SENT_NOTIFICATIONS_ITEM_IDS_KEY,
|
||||||
JSON.stringify([...new Set([...alreadySentItemIds, ...newIds])])
|
JSON.stringify([...new Set([...alreadySentItemIds, ...newIds])])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return newIds.length;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching recently added items:", error);
|
console.error("Error fetching recently added items:", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user