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:
@@ -36,7 +36,8 @@ export function SchoolSearchModal({ isOpen, onClose }: SchoolSearchModalProps) {
|
||||
|
||||
setIsSearching(true);
|
||||
try {
|
||||
const response = await fetch(`/api/schools?search=${encodeURIComponent(term)}&page_size=10`);
|
||||
const apiBaseUrl = process.env.NEXT_PUBLIC_API_URL || '/api';
|
||||
const response = await fetch(`${apiBaseUrl}/schools?search=${encodeURIComponent(term)}&page_size=10`);
|
||||
const data = await response.json();
|
||||
setResults(data.schools || []);
|
||||
setHasSearched(true);
|
||||
|
||||
Reference in New Issue
Block a user