diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index e9755c0..00ecc6e 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -49,6 +49,7 @@ const APP = () => { const [lineOfSightData, setLineOfSightData] = useState(null); const [loading, setLoading] = useState(false); const [isPlaying, setIsPlaying] = useState(false); + const [apiError, setApiError] = useState(null); const [flightSpeed, setFlightSpeed] = useState(1.0); const [mapStyle, setMapStyle] = useState('basic'); const [mapProjection, setMapProjection] = useState('globe'); @@ -382,6 +383,7 @@ const APP = () => { setIsLocked(false); setLineOfSightData(null); setSelectedCity(null); + setApiError(null); syncCitiesToMap([]); if (mapRef.current) { const map = mapRef.current; @@ -733,6 +735,7 @@ const APP = () => { const handleShowLineOfSight = async () => { setLoading(true); setSelectedCity(null); + setApiError(null); try { const response = await apiService.getLineOfSight( selectedPoint.lat, @@ -748,6 +751,7 @@ const APP = () => { renderLineOnMap(response.data.data); } catch (error) { console.error('Error fetching line of sight:', error); + setApiError('Failed to fetch route. Please try again.'); } finally { setLoading(false); // Reset flight progress for a new line calculation @@ -840,6 +844,12 @@ const APP = () => { + {apiError && ( +