Skip to content

Commit

Permalink
Always fetch node data from backend
Browse files Browse the repository at this point in the history
  • Loading branch information
starsep committed Feb 12, 2024
1 parent 7f6822e commit a3decf5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/components/sidebar/buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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({
Expand Down
13 changes: 0 additions & 13 deletions src/osm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,6 @@ export async function fetchNodeData(
});
}

export async function fetchNodeDataFromOsm(
nodeId: string,
): Promise<DefibrillatorData | null> {
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,
Expand Down

0 comments on commit a3decf5

Please sign in to comment.