Refactor
This commit is contained in:
parent
eb99cbe544
commit
83b8c86cac
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue