zeroed-some/localtoast / 84c08fc

Browse files

satisfy tha linta

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
84c08fc3d0021a0d87ddfd17176f63e37aea0f66
Parents
22c5c99
Tree
e07ecfe

1 changed file

StatusFile+-
M frontend/lib/api.ts 6 4
frontend/lib/api.tsmodified
@@ -97,11 +97,13 @@ export const restaurantApi = {
97
         params: { lat, lng, radius }
97
         params: { lat, lng, radius }
98
       });
98
       });
99
       return response.data;
99
       return response.data;
100
-    } catch (error: any) {
100
+    } catch (error) {
101
       // Handle the bizarre 404-with-data issue from Railway
101
       // Handle the bizarre 404-with-data issue from Railway
102
-      if (error.response?.status === 404 && Array.isArray(error.response?.data)) {
102
+      if (axios.isAxiosError(error)) {
103
-        console.warn('Got 404 with valid data - returning data anyway');
103
+        if (error.response?.status === 404 && Array.isArray(error.response?.data)) {
104
-        return error.response.data;
104
+          console.warn('Got 404 with valid data - returning data anyway');
105
+          return error.response.data as PlaceSearchResult[];
106
+        }
105
       }
107
       }
106
       throw error;
108
       throw error;
107
     }
109
     }