Remove unused authorization header logic from fetch options in getTopLangs function

This commit is contained in:
Seth 2025-01-15 13:08:15 -05:00
parent 47a029baba
commit 38b57d0955
No known key found for this signature in database
GPG key ID: 8B7A2C60CDF65CAC

View file

@ -6,17 +6,9 @@ type repo = {
} }
type repos = repo[] type repos = repo[]
const fetchOpts: RequestInit = {}
if (process.env.AuthorizationHeaderToken) {
fetchOpts.headers = {
"Authorization": `Bearer ${process.env.AuthorizationHeaderToken}`
}
}
const getTopLangs = async (type: "users" | "orgs", name: string) => { const getTopLangs = async (type: "users" | "orgs", name: string) => {
const obj: Record<string, number> = {} const obj: Record<string, number> = {}
const repoResp = await fetch(`https://git.creations.works/api/v1/${type}/${name}/repos?limit=0`, fetchOpts); const repoResp = await fetch(`https://git.creations.works/api/v1/${type}/${name}/repos?limit=0`);
const repos = await repoResp.json() as repos | { message: string }; const repos = await repoResp.json() as repos | { message: string };
if ("message" in repos) { if ("message" in repos) {