Fix: Use correct API base URL for client-side fetches
All checks were successful
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 34s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 1m10s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 1s

The compare screen and school search modal were not working because
they were fetching from '/api' directly instead of using the
NEXT_PUBLIC_API_URL environment variable that points to the backend.

Fixed client-side fetch calls in:
- ComparisonView: Fetch comparison data with correct API URL
- SchoolSearchModal: Search schools with correct API URL

This ensures client-side requests go to the FastAPI backend at
the configured URL (e.g., http://localhost:8000/api) rather than
trying to hit non-existent Next.js API routes.

Fixes comparison screen showing no data when schools are selected.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Tudor
2026-02-02 22:42:21 +00:00
parent 19e5199443
commit f04e383ea3
2 changed files with 4 additions and 2 deletions

View File

@@ -55,7 +55,8 @@ export function ComparisonView({
// Fetch comparison data
if (selectedSchools.length > 0) {
fetch(`/api/compare?urns=${urns}`)
const apiBaseUrl = process.env.NEXT_PUBLIC_API_URL || '/api';
fetch(`${apiBaseUrl}/compare?urns=${urns}`)
.then((res) => res.json())
.then((data) => setComparisonData(data.comparison))
.catch((err) => console.error('Failed to fetch comparison:', err));