diff --git a/frontend/src/components/dashboard/DashboardHome.tsx b/frontend/src/components/dashboard/DashboardHome.tsx index feeb9c8..e2d5115 100644 --- a/frontend/src/components/dashboard/DashboardHome.tsx +++ b/frontend/src/components/dashboard/DashboardHome.tsx @@ -57,7 +57,15 @@ export function DashboardHome() { }, body: JSON.stringify({ name, git_url: gitUrl, branch }) }) + + if (!response.ok) { + const err = await response.json().catch(() => ({})) + throw new Error(err.detail || 'Failed to add repository') + } + const data = await response.json() + if (!data.repo_id) throw new Error('Missing repo_id in response') + await fetch(`${API_URL}/repos/${data.repo_id}/index`, { method: 'POST', headers: { 'Authorization': `Bearer ${session?.access_token}` }