fix: 从 graph API 响应对象中提取 commits 数组

This commit is contained in:
2026-06-19 22:59:02 +08:00
parent bf8fb62b07
commit 8f346999fb
3 changed files with 5 additions and 3 deletions
+2 -1
View File
@@ -99,7 +99,8 @@
try {
const graphResp = await fetch(`/api/repos/${repoId}/graph?max_commits=20`);
if (graphResp.ok) {
commits = await graphResp.json();
const gd = await graphResp.json();
commits = gd.commits || [];
}
} catch (e) {
console.warn('Failed to load recent commits:', e);
+1 -1
View File
@@ -173,7 +173,7 @@
let commits = [];
try {
const graphResp = await fetch(`/api/repos/${repoId}/graph?max_commits=20`);
if (graphResp.ok) commits = await graphResp.json();
if (graphResp.ok) { const gd = await graphResp.json(); commits = gd.commits || []; }
} catch (e) { /* ignore */ }
populateRefSelects(currentRefs, commits);
+2 -1
View File
@@ -121,7 +121,8 @@
try {
const graphResp = await fetch(`/api/repos/${repoId}/graph?max_commits=20`);
if (graphResp.ok) {
commits = await graphResp.json();
const gd = await graphResp.json();
commits = gd.commits || [];
}
} catch (e) {
console.warn('Failed to load recent commits:', e);