diff --git a/nextjs-app/components/ComparisonView.tsx b/nextjs-app/components/ComparisonView.tsx index b3bbb1f..c4a4cb4 100644 --- a/nextjs-app/components/ComparisonView.tsx +++ b/nextjs-app/components/ComparisonView.tsx @@ -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)); diff --git a/nextjs-app/components/SchoolSearchModal.tsx b/nextjs-app/components/SchoolSearchModal.tsx index a100c43..f7734e0 100644 --- a/nextjs-app/components/SchoolSearchModal.tsx +++ b/nextjs-app/components/SchoolSearchModal.tsx @@ -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);