[claude] Phase 2 cleanup: route remaining fetch() through data/ modules (#421) (#461)
Some checks failed
Deploy Nexus / deploy (push) Failing after 3s
Staging Smoke Test / smoke-test (push) Failing after 0s

This commit was merged in pull request #461.
This commit is contained in:
2026-03-24 22:07:19 +00:00
parent 764b617a2a
commit c0a673038b
3 changed files with 41 additions and 53 deletions

View File

@@ -139,4 +139,25 @@ export async function refreshAgentData() {
}
}
export async function fetchMergedPRs(limit = 20) {
try {
const res = await fetch(
`${GITEA_BASE}/repos/Timmy_Foundation/the-nexus/pulls?state=closed&limit=${limit}`,
{ headers: { 'Authorization': `token ${GITEA_TOKEN}` } }
);
if (!res.ok) return [];
const data = await res.json();
return data
.filter(p => p.merged)
.map(p => ({
prNum: p.number,
title: p.title
.replace(/^\[[\w\s]+\]\s*/i, '')
.replace(/\s*\(#\d+\)\s*$/, ''),
}));
} catch {
return [];
}
}
export { GITEA_BASE, GITEA_TOKEN, GITEA_REPOS, AGENT_NAMES, CACHE_MS as AGENT_STATUS_CACHE_MS };