Add stars count repository

This commit is contained in:
vab1997
2023-05-10 17:06:42 -03:00
parent 7ef31b6af2
commit e9b097faec
3 changed files with 23 additions and 5 deletions
+10
View File
@@ -0,0 +1,10 @@
export async function fetchGitHubStars() {
const res = await fetch('https://api.github.com/repos/pheralb/svgl');
const response = await res.json();
const starsFormated =
response.stargazers_count > 1000
? `${(response.stargazers_count / 1000).toFixed(1)}K`
: response.stargazers_count;
return starsFormated;
}