Skip to content

Commit 1621da8

Browse files
sounmindsoobingclaude
committed
refactor: use getGitHubHeaders in learningData.js
์ธ๋ผ์ธ ํ—ค๋” ๋Œ€์‹  ๊ณต์œ  ์œ ํ‹ธ๋ฆฌํ‹ฐ ํ•จ์ˆ˜ ์‚ฌ์šฉ์œผ๋กœ ์ผ๊ด€์„ฑ ํ™•๋ณด Co-Authored-By: Soobin Bak <soobing@users.noreply.github.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e18033c commit 1621da8

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

โ€Žutils/learningData.jsโ€Ž

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* Learning data fetching utilities for DaleStudy GitHub App
33
*/
44

5+
import { getGitHubHeaders } from "./github.js";
6+
57
/**
68
* Fetches problem-categories.json from the repo root via GitHub API.
79
* Returns parsed JSON object, or null if the file is not found (404).
@@ -17,9 +19,8 @@ export async function fetchProblemCategories(repoOwner, repoName, appToken) {
1719

1820
const response = await fetch(url, {
1921
headers: {
20-
Authorization: `Bearer ${appToken}`,
22+
...getGitHubHeaders(appToken),
2123
Accept: "application/vnd.github.raw+json",
22-
"User-Agent": "DaleStudy-GitHub-App",
2324
},
2425
});
2526

@@ -57,11 +58,7 @@ export async function fetchUserSolutions(
5758
const url = `https://api.github.com/repos/${repoOwner}/${repoName}/git/trees/main?recursive=1`;
5859

5960
const response = await fetch(url, {
60-
headers: {
61-
Authorization: `Bearer ${appToken}`,
62-
Accept: "application/vnd.github+json",
63-
"User-Agent": "DaleStudy-GitHub-App",
64-
},
61+
headers: getGitHubHeaders(appToken),
6562
});
6663

6764
if (!response.ok) {
@@ -113,11 +110,7 @@ export async function fetchPRSubmissions(
113110
const url = `https://api.github.com/repos/${repoOwner}/${repoName}/pulls/${prNumber}/files?per_page=100`;
114111

115112
const response = await fetch(url, {
116-
headers: {
117-
Authorization: `Bearer ${appToken}`,
118-
Accept: "application/vnd.github+json",
119-
"User-Agent": "DaleStudy-GitHub-App",
120-
},
113+
headers: getGitHubHeaders(appToken),
121114
});
122115

123116
if (!response.ok) {

0 commit comments

Comments
ย (0)