From 40419b83371ed65ce0e64b95ccc1ccde3020b98d Mon Sep 17 00:00:00 2001 From: Gwynn Dandridge-Perry Date: Thu, 13 Oct 2022 09:56:57 -0700 Subject: [PATCH] fix: capture detail dialog open from captures & capture-match (#891) --- src/api/treeTrackerApi.js | 2 +- src/components/CaptureMatching/CaptureMatchingView.js | 3 ++- src/components/Captures/CaptureTable.js | 4 ++-- src/context/CaptureDetailContext.js | 4 +++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/api/treeTrackerApi.js b/src/api/treeTrackerApi.js index 46735fba9..f1480e7d0 100644 --- a/src/api/treeTrackerApi.js +++ b/src/api/treeTrackerApi.js @@ -246,7 +246,7 @@ export default { }, getSpeciesById(id) { try { - const query = `${API_ROOT}/api/species/${id}`; + const query = `${API_ROOT}/api/species?filter={"where":{"uuid": "${id}"}}`; return fetch(query, { method: 'GET', diff --git a/src/components/CaptureMatching/CaptureMatchingView.js b/src/components/CaptureMatching/CaptureMatchingView.js index 6dbd11585..b87385098 100644 --- a/src/components/CaptureMatching/CaptureMatchingView.js +++ b/src/components/CaptureMatching/CaptureMatchingView.js @@ -817,8 +817,9 @@ function CaptureMatchingView() { {isDetailsPaneOpen && ( )} diff --git a/src/components/Captures/CaptureTable.js b/src/components/Captures/CaptureTable.js index 6989fddab..7a9d78fa1 100644 --- a/src/components/Captures/CaptureTable.js +++ b/src/components/Captures/CaptureTable.js @@ -327,7 +327,7 @@ const CaptureTable = () => { > {columns.map(({ attr, renderer }, i) => ( @@ -356,7 +356,7 @@ const CaptureTable = () => { open={captureDetail.isDetailsPaneOpen} captureId={captureDetail.id} onClose={closeDrawer} - page={'CAPTURES'} + page={'LEGACY'} /> diff --git a/src/context/CaptureDetailContext.js b/src/context/CaptureDetailContext.js index 3a7e28a90..db20a455c 100644 --- a/src/context/CaptureDetailContext.js +++ b/src/context/CaptureDetailContext.js @@ -1,10 +1,11 @@ import React, { useState, createContext, useEffect } from 'react'; -import { handleError } from '../api/apiUtils'; +import { handleError, getOrganization } from '../api/apiUtils'; import api from '../api/treeTrackerApi'; import * as loglevel from 'loglevel'; const log = loglevel.getLogger('../context/CaptureDetailContext'); +const API_ROOT = process.env.REACT_APP_API_ROOT; const QUERY_API = process.env.REACT_APP_QUERY_API_ROOT; export const CaptureDetailContext = createContext({ @@ -39,6 +40,7 @@ export function CaptureDetailProvider(props) { const getCaptureDetail = async (id, page) => { const BASE_URL = { + LEGACY: `${API_ROOT}/api/${getOrganization()}trees`, CAPTURES: `${QUERY_API}/v2/captures`, VERIFY: `${QUERY_API}/raw-captures`, };