diff --git a/backend/app/main.py b/backend/app/main.py index 352987b..d59fbff 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -57,11 +57,12 @@ if os.path.exists(static_dir): # Catch-all for SPA routing (must be last) @app.get("/{full_path:path}") async def serve_spa_routes(full_path: str): - # Don't catch API routes - if full_path.startswith("api/") or full_path.startswith("health") or full_path.startswith("project/"): + # Don't catch API routes or health endpoint + if full_path.startswith("api/") or full_path.startswith("health"): from fastapi import HTTPException raise HTTPException(status_code=404, detail="Not found") + # Serve SPA for all other routes (including /project/*) index_path = os.path.join(static_dir, "index.html") if os.path.exists(index_path): return FileResponse(index_path) diff --git a/frontend/src/api.ts b/frontend/src/api.ts index dda878e..fe06ae1 100644 --- a/frontend/src/api.ts +++ b/frontend/src/api.ts @@ -10,10 +10,22 @@ async function handleResponse(response: Response): Promise { return response.json(); } +// Paginated response type +interface PaginatedResponse { + items: T[]; + pagination: { + page: number; + limit: number; + total: number; + total_pages: number; + }; +} + // Project API export async function listProjects(): Promise { const response = await fetch(`${API_BASE}/projects`); - return handleResponse(response); + const data = await handleResponse>(response); + return data.items; } export async function createProject(data: { name: string; description?: string; is_public?: boolean }): Promise {