MCPcopy Create free account
hub / github.com/SyntaxUI/syntaxui / fetchStars

Function fetchStars

src/components/AnimatedBadge.tsx:13–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11
12 useEffect(() => {
13 const fetchStars = async () => {
14 if (stars > 100) return
15 try {
16 const response = await fetch(
17 'https://api.github.com/repos/syntaxui/syntaxui',
18 {
19 headers: process.env.NEXT_PUBLIC_GITHUB_OAUTH_TOKEN
20 ? {
21 Authorization: `Bearer ${process.env.NEXT_PUBLIC_GITHUB_OAUTH_TOKEN}`,
22 'Content-Type': 'application/json',
23 }
24 : {},
25 },
26 )
27
28 if (response.ok) {
29 const data = await response.json()
30 setStars(data.stargazers_count || 100)
31 }
32 } catch (error) {
33 console.error('Error fetching GitHub stars:', error)
34 }
35 }
36
37 fetchStars()
38 }, [stars, setStars])

Callers 1

AnimatedBadgeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected