From 6a98cb688d2c9901d4b8b4b81c7f9cc10abb05eb Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Mon, 27 Jul 2026 11:20:11 +0530 Subject: [PATCH] fix: use backticks for template literals in github.ts Template literals were using single quotes instead of backticks, causing ${GITHUB_API} and ${DEVPATH_REPO} to be treated as literal strings instead of interpolated variables. This broke all GitHub API calls by requesting literal URLs like '${GITHUB_API}/user' instead of the actual API endpoint. --- src/lib/github.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/github.ts b/src/lib/github.ts index 0bcac512..35a3ecd1 100644 --- a/src/lib/github.ts +++ b/src/lib/github.ts @@ -5,7 +5,7 @@ const DEVPATH_REPO = 'devpathindcommunity-india/DevPath-Web'; const PER_PAGE = process.env.NEXT_PUBLIC_GITHUB_PER_PAGE ?? '100'; export const fetchUserProfile = async (token: string) => { - const res = await fetch('${GITHUB_API}/user', { + const res = await fetch(`${GITHUB_API}/user`, { headers: { Authorization: `Bearer ${token}`, Accept: 'application/vnd.github.v3+json', @@ -17,7 +17,7 @@ export const fetchUserProfile = async (token: string) => { export const fetchUserRepos = async (token: string) => { const res = await fetch( - '${GITHUB_API}/user/repos?sort=updated&per_page=${PER_PAGE}&type=all', + `${GITHUB_API}/user/repos?sort=updated&per_page=${PER_PAGE}&type=all`, { headers: { Authorization: `Bearer ${token}`, @@ -76,7 +76,7 @@ export const fetchRepoContributorStats = async (token?: string) => { } let res = await fetch( - '${GITHUB_API}/repos/${DEVPATH_REPO}/stats/contributors', + `${GITHUB_API}/repos/${DEVPATH_REPO}/stats/contributors`, { headers } ); @@ -85,7 +85,7 @@ export const fetchRepoContributorStats = async (token?: string) => { while (res.status === 202 && retries < 3) { await new Promise((resolve) => setTimeout(resolve, 1500)); res = await fetch( - '${GITHUB_API}/repos/${DEVPATH_REPO}/stats/contributors', + `${GITHUB_API}/repos/${DEVPATH_REPO}/stats/contributors`, { headers } ); retries++;