From a3decf569378edc3b89b7f9be32760b750ec8967 Mon Sep 17 00:00:00 2001 From: Filip Czaplicki Date: Mon, 12 Feb 2024 17:44:11 +0100 Subject: [PATCH] Always fetch node data from backend --- src/components/sidebar/buttons.tsx | 4 ++-- src/osm.ts | 13 ------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/components/sidebar/buttons.tsx b/src/components/sidebar/buttons.tsx index 0d0675f..a7c2f12 100644 --- a/src/components/sidebar/buttons.tsx +++ b/src/components/sidebar/buttons.tsx @@ -11,10 +11,10 @@ import React, { FC } from "react"; import { Button } from "react-bulma-components"; import { useTranslation } from "react-i18next"; import { useAppContext } from "~/appContext"; +import { fetchNodeDataFromBackend } from "~/backend"; import { OSM_DOMAIN } from "~/constants"; import { ModalType, initialModalState } from "~/model/modal"; import SidebarAction from "~/model/sidebarAction"; -import { fetchNodeDataFromOsm } from "~/osm"; type OsmId = string; @@ -27,7 +27,7 @@ export function EditButton({ osmId }: { osmId: OsmId }) { authState: { auth }, } = useAppContext(); const startEdit = () => { - fetchNodeDataFromOsm(osmId).then((data) => { + fetchNodeDataFromBackend(osmId).then((data) => { setSidebarData(data); if (auth === null || !auth.authenticated()) { setModalState({ diff --git a/src/osm.ts b/src/osm.ts index 25623a6..4de50ed 100644 --- a/src/osm.ts +++ b/src/osm.ts @@ -36,19 +36,6 @@ export async function fetchNodeData( }); } -export async function fetchNodeDataFromOsm( - nodeId: string, -): Promise { - const url = `https://api.openstreetmap.org/api/0.6/node/${nodeId}.json`; - console.log( - "Request object info for node with osm id:", - nodeId, - " via url: ", - url, - ); - return fetchNodeData(url); -} - export function updateOsmUsernameState( auth: OSMAuth.osmAuth, setOsmUsername: (username: string) => void,