fix: 从 graph API 响应对象中提取 commits 数组
This commit is contained in:
@@ -99,7 +99,8 @@
|
|||||||
try {
|
try {
|
||||||
const graphResp = await fetch(`/api/repos/${repoId}/graph?max_commits=20`);
|
const graphResp = await fetch(`/api/repos/${repoId}/graph?max_commits=20`);
|
||||||
if (graphResp.ok) {
|
if (graphResp.ok) {
|
||||||
commits = await graphResp.json();
|
const gd = await graphResp.json();
|
||||||
|
commits = gd.commits || [];
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn('Failed to load recent commits:', e);
|
console.warn('Failed to load recent commits:', e);
|
||||||
|
|||||||
@@ -173,7 +173,7 @@
|
|||||||
let commits = [];
|
let commits = [];
|
||||||
try {
|
try {
|
||||||
const graphResp = await fetch(`/api/repos/${repoId}/graph?max_commits=20`);
|
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 */ }
|
} catch (e) { /* ignore */ }
|
||||||
|
|
||||||
populateRefSelects(currentRefs, commits);
|
populateRefSelects(currentRefs, commits);
|
||||||
|
|||||||
@@ -121,7 +121,8 @@
|
|||||||
try {
|
try {
|
||||||
const graphResp = await fetch(`/api/repos/${repoId}/graph?max_commits=20`);
|
const graphResp = await fetch(`/api/repos/${repoId}/graph?max_commits=20`);
|
||||||
if (graphResp.ok) {
|
if (graphResp.ok) {
|
||||||
commits = await graphResp.json();
|
const gd = await graphResp.json();
|
||||||
|
commits = gd.commits || [];
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn('Failed to load recent commits:', e);
|
console.warn('Failed to load recent commits:', e);
|
||||||
|
|||||||
Reference in New Issue
Block a user