mirror of
https://git.suyu.dev/suyu/website.git
synced 2026-01-04 13:44:25 +01:00
Fix star count
This commit is contained in:
parent
801bd34d9b
commit
5cee218403
1 changed files with 3 additions and 9 deletions
|
|
@ -19,21 +19,15 @@ async function fetchServerSideData() {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
: Promise.resolve({ json: () => roleMembers }),
|
: Promise.resolve({ json: () => roleMembers }),
|
||||||
GITLAB_API_TOKEN
|
fetch("https://git.suyu.dev/api/v1/repos/suyu/suyu"),
|
||||||
? fetch("https://gitlab.com/api/v4/projects/suyu-emu%2Fsuyu/", {
|
|
||||||
headers: {
|
|
||||||
Authorization: `Bearer ${GITLAB_API_TOKEN}`,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
: Promise.resolve({ json: () => ({ star_count: 0 }) }), // Default to 0 if no token is provided
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const [res, roles, gitlabRes] = await Promise.all(promises);
|
const [res, roles, gitlabRes] = await Promise.all(promises);
|
||||||
const jsonPromises = [res.json(), roles.json(), gitlabRes.json()];
|
const jsonPromises = [res.json(), roles.json(), gitlabRes.json()];
|
||||||
const [resJson, rolesJson, gitlabResJson] = await Promise.all(jsonPromises);
|
const [resJson, rolesJson, gitResJson] = await Promise.all(jsonPromises);
|
||||||
|
|
||||||
memberCount = resJson.approximate_member_count;
|
memberCount = resJson.approximate_member_count;
|
||||||
starCount = gitlabResJson.star_count;
|
starCount = gitResJson.stars_count;
|
||||||
if (DISCORD_USER_TOKEN) roleMembers = rolesJson;
|
if (DISCORD_USER_TOKEN) roleMembers = rolesJson;
|
||||||
|
|
||||||
console.log("Member count:", memberCount);
|
console.log("Member count:", memberCount);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue