Skip to content

Commit

Permalink
authenticate github api calls for development
Browse files Browse the repository at this point in the history
rate limit 60 => 5000
  • Loading branch information
thedannywahl committed Feb 16, 2024
1 parent 1d4c2df commit 65adeaa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion isp-site/src/utils/explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ async function getGithubRepoContents(owner, repo, branch) {
const apiUrl = `${global.api}/repos/${owner}/${repo}/git/trees/${branch}?recursive=1`;

try {
const response = await fetch(apiUrl);
const response = await fetch(apiUrl, {
method: "GET",
headers: {
Accept: "application/vnd.github.v3+json",
Authorization: process.env.REACT_APP_GITHUB_TOKEN
? `token ${process.env.REACT_APP_GITHUB_TOKEN}`
: "",
},
});
const data = await response.json();

return data.tree || null;
Expand Down

0 comments on commit 65adeaa

Please sign in to comment.