satisfy tha linta
Authored by
mfwolffe <wolffemf@dukes.jmu.edu>
- SHA
84c08fc3d0021a0d87ddfd17176f63e37aea0f66- Parents
-
22c5c99 - Tree
e07ecfe
84c08fc
84c08fc3d0021a0d87ddfd17176f63e37aea0f6622c5c99
e07ecfe| Status | File | + | - |
|---|---|---|---|
| M |
frontend/lib/api.ts
|
6 | 4 |
frontend/lib/api.tsmodified@@ -97,11 +97,13 @@ export const restaurantApi = { | ||
| 97 | 97 | params: { lat, lng, radius } |
| 98 | 98 | }); |
| 99 | 99 | return response.data; |
| 100 | - } catch (error: any) { | |
| 100 | + } catch (error) { | |
| 101 | 101 | // Handle the bizarre 404-with-data issue from Railway |
| 102 | - if (error.response?.status === 404 && Array.isArray(error.response?.data)) { | |
| 103 | - console.warn('Got 404 with valid data - returning data anyway'); | |
| 104 | - return error.response.data; | |
| 102 | + if (axios.isAxiosError(error)) { | |
| 103 | + if (error.response?.status === 404 && Array.isArray(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 | 108 | throw error; |
| 107 | 109 | } |