Skip to content

Commit

Permalink
fix: capture detail dialog open from captures & capture-match (Greens…
Browse files Browse the repository at this point in the history
  • Loading branch information
gwynndp authored Oct 13, 2022
1 parent bbbeadd commit 40419b8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/api/treeTrackerApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion src/components/CaptureMatching/CaptureMatchingView.js
Original file line number Diff line number Diff line change
Expand Up @@ -817,8 +817,9 @@ function CaptureMatchingView() {
{isDetailsPaneOpen && (
<CaptureDetailDialog
open={isDetailsPaneOpen}
captureId={captureImage?.reference_id}
captureId={captureImage?.id}
onClose={closeDrawer}
page={'CAPTURES'}
/>
)}
</CaptureDetailProvider>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Captures/CaptureTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ const CaptureTable = () => {
>
<TableRow
key={capture.id}
onClick={createToggleDrawerHandler(capture.uuid)}
onClick={createToggleDrawerHandler(capture.id)}
className={classes.tableRow}
>
{columns.map(({ attr, renderer }, i) => (
Expand Down Expand Up @@ -356,7 +356,7 @@ const CaptureTable = () => {
open={captureDetail.isDetailsPaneOpen}
captureId={captureDetail.id}
onClose={closeDrawer}
page={'CAPTURES'}
page={'LEGACY'}
/>
</CaptureDetailProvider>
</Grid>
Expand Down
4 changes: 3 additions & 1 deletion src/context/CaptureDetailContext.js
Original file line number Diff line number Diff line change
@@ -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({
Expand Down Expand Up @@ -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`,
};
Expand Down

0 comments on commit 40419b8

Please sign in to comment.