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 | 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 | 28 | function HomePage() { |
| 20 | 29 | const [userLocation, setUserLocation] = useState<{ lat: number; lng: number } | null>(null); |
| 21 | 30 | const [selectedRestaurant, setSelectedRestaurant] = useState<Restaurant | null>(null); |
@@ -96,8 +105,8 @@ function HomePage() { | ||
| 96 | 105 | setRestaurants(updatedRestaurants); |
| 97 | 106 | } |
| 98 | 107 | }, |
| 99 | - onError: () => { | |
| 100 | - alert('Failed to update toast status'); | |
| 108 | + onError: (error: ApiError) => { | |
| 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 | 8 | import { Restaurant } from '@/lib/api'; |
| 9 | 9 | |
| 10 | 10 | // Fix for default markers in React-Leaflet |
| 11 | +interface LeafletIconDefault extends L.Icon.Default { | |
| 12 | + _getIconUrl?: string; | |
| 13 | +} | |
| 14 | + | |
| 11 | 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 | 18 | L.Icon.Default.mergeOptions({ |
| 14 | 19 | iconRetinaUrl: '/leaflet/marker-icon-2x.png', |
| 15 | 20 | iconUrl: '/leaflet/marker-icon.png', |
frontend/components/RestaurantPanel.tsxmodified@@ -26,8 +26,6 @@ export default function RestaurantPanel({ restaurant, onClose, onAddRating }: Re | ||
| 26 | 26 | setShowRatingForm(false); |
| 27 | 27 | setRating(5); |
| 28 | 28 | setReview(''); |
| 29 | - } catch (_error) { | |
| 30 | - // Error handling done in parent | |
| 31 | 29 | } finally { |
| 32 | 30 | setIsSubmitting(false); |
| 33 | 31 | } |