Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Made GITHUB_OAUTH_TOKEN optional

Steven Tey68ce3827be9c
diff --git a/pages/index.tsx b/pages/index.tsx
index 81fb07e86b..782d918234 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -48,16 +48,19 @@ export async function getStaticProps() {
const { stargazers_count: stars } = await fetch(
"https://api.github.com/repos/steven-tey/dub",
{
- headers: {
- Authorization: `Bearer ${process.env.GITHUB_OAUTH_TOKEN}`,
- "Content-Type": "application/json",
- },
+ // optional – feel free to remove if you don't want to display star count
+ ...(process.env.GITHUB_OAUTH_TOKEN && {
+ headers: {
+ Authorization: `Bearer ${process.env.GITHUB_OAUTH_TOKEN}`,
+ "Content-Type": "application/json",
+ },
+ }),
}
).then((res) => res.json());
return {
props: {
- stars,
+ stars: stars || 0,
},
revalidate: 10,
};