Fix: Use correct API base URL for client-side fetches
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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user