Skip to content

Commit

Permalink
investigate api fetch not working in prod
Browse files Browse the repository at this point in the history
  • Loading branch information
Aliiiu committed Jan 14, 2025
1 parent 6f7383d commit 3d4a583
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/client/StatsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ const StatsPage = () => {
fontWeight="semibold"
>
<NumericDisplay
value={item.value || 0}
value={item.value}
prefix={valuePrefix}
isFetched={isFetched}
isFailedToFetchData={isFailedToFetchData}
Expand Down
10 changes: 8 additions & 2 deletions src/pages/api/social-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@ export default async function handler(

const redditResponse = await fetch(
'https://www.reddit.com/r/everipedia/about.json',
)
const twitterResponse = await fetch(url, options)
).then((res) => {
if (!res.ok) throw new Error('Reddit API failed')
return res.json()
})
const twitterResponse = await fetch(url, options).then((res) => {
if (!res.ok) throw new Error('Twitter API failed')
return res.json()
})

const { followers_count: twitterFollowers } = await twitterResponse.json()
const redditData = await redditResponse.json()
Expand Down

0 comments on commit 3d4a583

Please sign in to comment.