✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.
fix: fetch stargazers
AykutSarace9d554bd39cd
diff --git a/src/pages/index.tsx b/src/pages/index.tsxindex 1e03a361..19de3a3c 100644--- a/src/pages/index.tsx+++ b/src/pages/index.tsx@@ -29,12 +29,20 @@ export const HomePage = (props: InferGetStaticPropsType<typeof getStaticProps>)export default HomePage;export const getStaticProps = (async () => {- const res = await fetch("https://api.github.com/repos/AykutSarac/jsoncrack.com");- const data = await res.json();+ try {+ const res = await fetch("https://api.github.com/repos/AykutSarac/jsoncrack.com");+ const data = await res.json();- return {- props: {- stars: data.stargazers_count,- },- };+ return {+ props: {+ stars: data?.stargazers_count || 0,+ },+ };+ } catch (error) {+ return {+ props: {+ stars: 0,+ },+ };+ }}) satisfies GetStaticProps<{ stars: number }>;