fix: expose lat/lng from CoastalPoint, fix getCoords in map

This commit is contained in:
Gwadaking
2026-04-01 22:37:14 -04:00
parent 15079ea7b4
commit 1485339aec
2 changed files with 22 additions and 4 deletions

View File

@@ -43,7 +43,7 @@ export default function SargassesMap({ onSpotSelect, selectedSpotId, activeStep
// Spots côtiers : chargement unique
useEffect(() => {
api.spots.list()
.then(data => setSpots(data['hydra:member'] ?? data.member ?? []))
.then(data => setSpots(Array.isArray(data) ? data : (data['hydra:member'] ?? data.member ?? [])))
.catch(console.error);
}, []);
@@ -83,8 +83,10 @@ export default function SargassesMap({ onSpotSelect, selectedSpotId, activeStep
};
const getCoords = (spot) => {
const c = spot.geometry?.coordinates;
return c ? { lng: c[0], lat: c[1] } : null;
if (spot.longitude != null && spot.latitude != null) {
return { lng: spot.longitude, lat: spot.latitude };
}
return null;
};
return (