diff --git a/src/utils/getTrends.ts b/src/utils/getTrends.ts index 6a04d4e1..78a9058c 100644 --- a/src/utils/getTrends.ts +++ b/src/utils/getTrends.ts @@ -1,5 +1,10 @@ export default async function getTrends() { - const data = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/stats/getTrends`); - const trends = await data.json(); - return trends; + try { + const data = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/stats/getTrends`); + const trends = await data.json(); + return trends; + } catch (error) { + console.error("Error fetching trends:", error); + return []; + } } \ No newline at end of file