Skip to content

Commit

Permalink
EditDialog: fix clicking on nodes in Members/ParentsEditor (#874)
Browse files Browse the repository at this point in the history
  • Loading branch information
zbycz authored Jan 7, 2025
1 parent 127b81f commit 048d4fe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/services/osmApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const getOsmParentUrl = ({ type, id }: OsmId) =>
`https://api.openstreetmap.org/api/0.6/${type}/${id}/relations.json`;
const getOsmHistoryUrl = ({ type, id }: OsmId) =>
`https://api.openstreetmap.org/api/0.6/${type}/${id}/history.json`;
const getOsmUrlOrFull = ({ type, id }: OsmId) =>
type === 'node' ? getOsmUrl({ type, id }) : getOsmFullUrl({ type, id });

type OsmTypes = 'node' | 'way' | 'relation';
type OsmElement<T extends OsmTypes = 'node' | 'way' | 'relation'> = {
Expand Down Expand Up @@ -284,7 +286,7 @@ const addMemberFeaturesToArea = async (relation: Feature) => {

export const getFullFeatureWithMemberFeatures = async (apiId: OsmId) => {
await fetchSchemaTranslations();
const full = await fetchJson<OsmResponse>(getOsmFullUrl(apiId));
const full = await fetchJson<OsmResponse>(getOsmUrlOrFull(apiId));
const map = getItemsMap(full.elements);
const feature = addSchemaToFeature(osmToFeature(map[apiId.type][apiId.id]));
return {
Expand Down

0 comments on commit 048d4fe

Please sign in to comment.