zeroed-some/localtoast / 7b8e987

Browse files

satisfy the lintah

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
7b8e9877e23f1111322cf63640ed1cbe15b44e56
Parents
f38d804
Tree
bbe8a7e

3 changed files

StatusFile+-
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'), {
1616
   loading: () => <div className="h-full w-full bg-gray-100 animate-pulse" />,
1717
 });
1818
 
19
+// Type for API errors
20
+type ApiError = {
21
+  response?: {
22
+    data?: {
23
+      error?: string;
24
+    };
25
+  };
26
+};
27
+
1928
 function HomePage() {
2029
   const [userLocation, setUserLocation] = useState<{ lat: number; lng: number } | null>(null);
2130
   const [selectedRestaurant, setSelectedRestaurant] = useState<Restaurant | null>(null);
@@ -96,8 +105,8 @@ function HomePage() {
96105
         setRestaurants(updatedRestaurants);
97106
       }
98107
     },
99
-    onError: () => {
100
-      alert('Failed to update toast status');
108
+    onError: (error: ApiError) => {
109
+      alert(error.response?.data?.error || 'Failed to update toast status');
101110
     },
102111
   });
103112
 
frontend/components/Map.tsxmodified
@@ -8,8 +8,13 @@ import { Star, ThumbsUp, ThumbsDown, MessageSquare } from 'lucide-react';
88
 import { Restaurant } from '@/lib/api';
99
 
1010
 // Fix for default markers in React-Leaflet
11
+interface LeafletIconDefault extends L.Icon.Default {
12
+  _getIconUrl?: string;
13
+}
14
+
1115
 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;
1318
   L.Icon.Default.mergeOptions({
1419
     iconRetinaUrl: '/leaflet/marker-icon-2x.png',
1520
     iconUrl: '/leaflet/marker-icon.png',
frontend/components/RestaurantPanel.tsxmodified
@@ -26,8 +26,6 @@ export default function RestaurantPanel({ restaurant, onClose, onAddRating }: Re
2626
       setShowRatingForm(false);
2727
       setRating(5);
2828
       setReview('');
29
-    } catch (_error) {
30
-      // Error handling done in parent
3129
     } finally {
3230
       setIsSubmitting(false);
3331
     }