From 814c8708b6652fc14c1563e2c3fb0ea84d7dd48d Mon Sep 17 00:00:00 2001 From: Andrea Albiac Date: Wed, 4 Dec 2024 17:59:34 +0100 Subject: [PATCH] Reverted stats --- packages/nextjs/pages/index.tsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index 09f58a1..f9eca4f 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -438,16 +438,15 @@ const Home: NextPage<{ }; export const getStaticProps: GetStaticProps<{ stats: Stats }> = async () => { + const res = await fetch(`${process.env.NEXT_PUBLIC_BG_BACKEND_API}/api/stats`); + + if (!res.ok) throw new Error(`Failed to fetch stats, received status ${res.status}`); + + const stats = (await res.json()) as Stats; + return { props: { - stats: { - builderCount: "50", - buildCount: "100", - streamedEth: 100, - buildersIncrementMonth: 10, - buildsIncrementMonth: 10, - streamedEthIncrement: 10, - }, + stats, }, // 6 hours refresh. revalidate: 21600,