diff --git a/be/src/fetchItemsFromJellyfin.ts b/be/src/fetchItemsFromJellyfin.ts index b3e77f5..366fcca 100644 --- a/be/src/fetchItemsFromJellyfin.ts +++ b/be/src/fetchItemsFromJellyfin.ts @@ -22,8 +22,6 @@ export const fetchFromApi = async () => { } return response.json(); }) - .then(data => console.log(data)) .catch(error => console.error('Error:', error)); - console.log("response:", response); + return response; } - diff --git a/be/src/main.ts b/be/src/main.ts index 218f60e..f04c070 100644 --- a/be/src/main.ts +++ b/be/src/main.ts @@ -1,3 +1,16 @@ import { fetchFromApi } from "./fetchItemsFromJellyfin.ts"; -fetchFromApi(); +interface JellyfinApiResponse { + Items?: [], + TotalRecordCount?: number, + StartIndex?: number, +}; + +const init = async () => { + const response: JellyfinApiResponse = await fetchFromApi(); + const { Items: items, TotalRecordCount: totalItemCount } = response; + console.log("items:", items); + console.log("totalItemCount:", totalItemCount); +} + +init();