diff --git a/trending.js b/trending.js index 8774bed..4bc2587 100644 --- a/trending.js +++ b/trending.js @@ -1,7 +1,10 @@ -export async function fetchTrendingRepos() { +export async function fetchTrendingRepos(): Promise { try { const response = await fetch('/backend/api/trending'); - const repos = await response.json(); + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + const repos: RepoType[] = await response.json(); return repos; } catch (error) { console.error('Error fetching trending repositories:', error);