Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
#157-isochrones route error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
bariela committed Sep 21, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 3bb7cc1 commit de06bc7
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions api/src/actions/isochrones.ts
Original file line number Diff line number Diff line change
@@ -13,17 +13,19 @@ export const getIsochronesByPointsSource = async (pointsSource: string, bottomLe
// const pointStrings = points.map((point) => JSON.stringify(point));
const isochrones = await getIsochronesByCoordinates(true);
const isochroneFeatures = [];
isochrones.forEach((item) => {
item.features.forEach((feature) => {
const enhancedFeature = {
type: feature.type,
geometry: feature.geometry,
properties: feature.properties,
id: `${item._id}-${feature.properties.value}`,
};
isochroneFeatures.push(enhancedFeature);
if (isochrones && isochrones.length) {
isochrones.forEach((item) => {
item.features.forEach((feature) => {
const enhancedFeature = {
type: feature.type,
geometry: feature.geometry,
properties: feature.properties,
id: `${item._id}-${feature.properties.value}`,
};
isochroneFeatures.push(enhancedFeature);
});
});
});
}
return isochroneFeatures;
}
throw new APIError(`pointsSource ${pointsSource} is not valid.`, 400, true);

0 comments on commit de06bc7

Please sign in to comment.