mirror of
https://github.com/Jellify-Music/App.git
synced 2026-01-06 19:09:52 -06:00
adding some logging
This commit is contained in:
@@ -2,16 +2,24 @@ import { Api } from "@jellyfin/sdk/lib/api";
|
||||
import { BaseItemDto, ItemSortBy } from "@jellyfin/sdk/lib/generated-client/models";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
|
||||
export function fetchRecentlyPlayed(api: Api): Promise<BaseItemDto[] | undefined> {
|
||||
export function fetchRecentlyPlayed(api: Api): Promise<BaseItemDto[]> {
|
||||
|
||||
console.debug("Fetching recently played items");
|
||||
|
||||
return new Promise(async (resolve, reject) => {
|
||||
getItemsApi(api).getItems({ sortBy: [ ItemSortBy.DatePlayed ], limit: 100 })
|
||||
.then((response) => {
|
||||
|
||||
console.debug("Received recently played items response");
|
||||
|
||||
if (response.data.Items)
|
||||
resolve(response.data.Items);
|
||||
else {
|
||||
resolve([]);
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.error(error);
|
||||
reject(error);
|
||||
})
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user