Skip to content

Commit 91b05ff

Browse files
committed
Final 2
1 parent 2f0dcb4 commit 91b05ff

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

GithubSearch/app.js

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,4 @@
11
console.log("hello");
2-
// Replace 'your_token_here' with your personal access token
3-
const token = "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";
4-
const headers = new Headers({
5-
Authorization: `token ${token}`,
6-
});
7-
8-
async function checkRateLimit() {
9-
try {
10-
const response = await fetch("https://api.github.com/rate_limit", {
11-
headers,
12-
});
13-
const rateLimit = await response.json();
14-
const core = rateLimit.rate;
15-
const resetTime = new Date(core.reset * 1000);
16-
} catch (error) {
17-
console.error("Error fetching rate limit:", error);
18-
}
19-
}
20-
21-
checkRateLimit();
222

233
const nav = document.querySelectorAll("nav a");
244
nav.forEach((el) => {
@@ -45,11 +25,10 @@ searchBtn.addEventListener("click", () => {
4525
});
4626

4727
async function searchprofile(url, repo) {
48-
checkRateLimit();
4928

50-
let search = await fetch(url, { headers });
29+
let search = await fetch(url);
5130
let data = await search.json();
52-
let fetchRepo = await fetch(repo, { headers });
31+
let fetchRepo = await fetch(repo);
5332
let repos = await fetchRepo.json();
5433
fetchedData(search, data, repos);
5534
}

0 commit comments

Comments
 (0)