This repository was archived by the owner on Apr 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-19
lines changed
Expand file tree Collapse file tree 2 files changed +8
-19
lines changed Original file line number Diff line number Diff line change @@ -23,27 +23,12 @@ export default async function handler(
2323 } ,
2424 }
2525
26- const redditResponse = await fetch (
27- 'https://www.reddit.com/r/everipedia/about.json' ,
28- {
29- headers : {
30- 'User-Agent' : 'IQ-UI/1.0' ,
31- } ,
32- } ,
33- ) . then ( ( res ) => {
34- if ( ! res . ok ) throw new Error ( 'Reddit API failed' )
35- return res . json ( )
36- } )
37- const twitterResponse = await fetch ( url , options ) . then ( ( res ) => {
38- if ( ! res . ok ) throw new Error ( 'Twitter API failed' )
39- return res . json ( )
40- } )
26+ const twitterResponse = await fetch ( url , options )
4127
4228 const { followers_count : twitterFollowers } = await twitterResponse . json ( )
43- const redditData = await redditResponse . json ( )
29+
4430 const data = {
4531 twitterFollowers,
46- redditFollowers : redditData . data . subscribers ,
4732 }
4833
4934 setCacheHeaders ( res )
Original file line number Diff line number Diff line change @@ -329,12 +329,16 @@ const getEpData = async () => {
329329
330330const getSocialData = async ( ) => {
331331 try {
332+ const redditResponse = await fetch (
333+ 'https://www.reddit.com/r/everipedia/about.json' ,
334+ )
332335 const twitterResponse = await fetch ( '/api/social-data' )
333- const { twitterFollowers, redditFollowers } = await twitterResponse . json ( )
336+ const { twitterFollowers } = await twitterResponse . json ( )
337+ const redditData = await redditResponse . json ( )
334338 return {
335339 social : {
336340 twitter : twitterFollowers ,
337- reddit : redditFollowers ,
341+ reddit : redditData . data . subscribers ,
338342 } ,
339343 }
340344 } catch ( err ) {
You can’t perform that action at this time.
0 commit comments