satisfy the lintah
Authored by
mfwolffe <wolffemf@dukes.jmu.edu>
- SHA
7b8e9877e23f1111322cf63640ed1cbe15b44e56- Parents
-
f38d804 - Tree
bbe8a7e
7b8e987
7b8e9877e23f1111322cf63640ed1cbe15b44e56f38d804
bbe8a7e| Status | File | + | - |
|---|---|---|---|
| M |
frontend/app/page.tsx
|
11 | 2 |
| M |
frontend/components/Map.tsx
|
6 | 1 |
| M |
frontend/components/RestaurantPanel.tsx
|
0 | 2 |
frontend/app/page.tsxmodified@@ -16,6 +16,15 @@ const Map = dynamic(() => import('@/components/Map'), { | |||
| 16 | loading: () => <div className="h-full w-full bg-gray-100 animate-pulse" />, | 16 | loading: () => <div className="h-full w-full bg-gray-100 animate-pulse" />, |
| 17 | }); | 17 | }); |
| 18 | 18 | ||
| 19 | +// Type for API errors | ||
| 20 | +type ApiError = { | ||
| 21 | + response?: { | ||
| 22 | + data?: { | ||
| 23 | + error?: string; | ||
| 24 | + }; | ||
| 25 | + }; | ||
| 26 | +}; | ||
| 27 | + | ||
| 19 | function HomePage() { | 28 | function HomePage() { |
| 20 | const [userLocation, setUserLocation] = useState<{ lat: number; lng: number } | null>(null); | 29 | const [userLocation, setUserLocation] = useState<{ lat: number; lng: number } | null>(null); |
| 21 | const [selectedRestaurant, setSelectedRestaurant] = useState<Restaurant | null>(null); | 30 | const [selectedRestaurant, setSelectedRestaurant] = useState<Restaurant | null>(null); |
@@ -96,8 +105,8 @@ function HomePage() { | |||
| 96 | setRestaurants(updatedRestaurants); | 105 | setRestaurants(updatedRestaurants); |
| 97 | } | 106 | } |
| 98 | }, | 107 | }, |
| 99 | - onError: () => { | 108 | + onError: (error: ApiError) => { |
| 100 | - alert('Failed to update toast status'); | 109 | + alert(error.response?.data?.error || 'Failed to update toast status'); |
| 101 | }, | 110 | }, |
| 102 | }); | 111 | }); |
| 103 | 112 | ||
frontend/components/Map.tsxmodified@@ -8,8 +8,13 @@ import { Star, ThumbsUp, ThumbsDown, MessageSquare } from 'lucide-react'; | |||
| 8 | import { Restaurant } from '@/lib/api'; | 8 | import { Restaurant } from '@/lib/api'; |
| 9 | 9 | ||
| 10 | // Fix for default markers in React-Leaflet | 10 | // Fix for default markers in React-Leaflet |
| 11 | +interface LeafletIconDefault extends L.Icon.Default { | ||
| 12 | + _getIconUrl?: string; | ||
| 13 | +} | ||
| 14 | + | ||
| 11 | if (typeof window !== 'undefined') { | 15 | if (typeof window !== 'undefined') { |
| 12 | - delete (L.Icon.Default.prototype as Record<string, any>)._getIconUrl; | 16 | + const iconDefault = L.Icon.Default.prototype as LeafletIconDefault; |
| 17 | + delete iconDefault._getIconUrl; | ||
| 13 | L.Icon.Default.mergeOptions({ | 18 | L.Icon.Default.mergeOptions({ |
| 14 | iconRetinaUrl: '/leaflet/marker-icon-2x.png', | 19 | iconRetinaUrl: '/leaflet/marker-icon-2x.png', |
| 15 | iconUrl: '/leaflet/marker-icon.png', | 20 | iconUrl: '/leaflet/marker-icon.png', |
frontend/components/RestaurantPanel.tsxmodified@@ -26,8 +26,6 @@ export default function RestaurantPanel({ restaurant, onClose, onAddRating }: Re | |||
| 26 | setShowRatingForm(false); | 26 | setShowRatingForm(false); |
| 27 | setRating(5); | 27 | setRating(5); |
| 28 | setReview(''); | 28 | setReview(''); |
| 29 | - } catch (_error) { | ||
| 30 | - // Error handling done in parent | ||
| 31 | } finally { | 29 | } finally { |
| 32 | setIsSubmitting(false); | 30 | setIsSubmitting(false); |
| 33 | } | 31 | } |