Compare commits

...

2 commits

View file

@ -16,10 +16,10 @@ if (process.env.AuthorizationHeaderToken) {
const getTopLangs = async (type: "users" | "orgs", name: string) => {
const obj: Record<string, number> = {}
const userRepoResp = await fetch(`https://git.creations.works/api/v1/${type}/${name}/repos?limit=0`, fetchOpts);
const userRepos = await userRepoResp.json() as repos;
const repoResp = await fetch(`https://git.creations.works/api/v1/${type}/${name}/repos?limit=0`, fetchOpts);
const repos = await repoResp.json() as repos;
for (const repo of userRepos) {
for (const repo of repos) {
const lang = repo.language;
if (obj[lang] && lang !== "") {
@ -65,11 +65,11 @@ Bun.serve({
const name = searchParams.get("name") as string;
if (!type) {
return new Response("Please provide a type parameter, user or orgs", { status: 400 });
return new Response("Please provide a type parameter, users or orgs", { status: 400 });
}
if (type !== "users" && type !== "orgs") {
return new Response("Type parameter must be either user or orgs", { status: 400 });
return new Response("Type parameter must be either users or orgs", { status: 400 });
}
if (!name) {