Skip to content

Commit

Permalink
move drugChemicalPair fetcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Woozl committed Oct 22, 2024
1 parent fe27065 commit a8d6e55
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
16 changes: 16 additions & 0 deletions src/API/explorePage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import utils from './utils';
import { api } from './baseUrlProxy';

const routes = {
async getDrugChemicalPairs() {
let response;
try {
response = await api.post('/api/explore');
} catch (error) {
return utils.handleAxiosError(error);
}
return response.data;
},
};

export default routes;
7 changes: 2 additions & 5 deletions src/pages/explore/DrugDiseasePairs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { useHistory, Link } from 'react-router-dom';
import QueryBuilderContext from '~/context/queryBuilder';
import useQueryBuilder from '../queryBuilder/useQueryBuilder';
import { api } from '../../API/baseUrlProxy';
import explorePage from '~/API/explorePage';

const useStyles = makeStyles({
hover: {
Expand All @@ -20,10 +20,7 @@ const useStyles = makeStyles({
},
});

const fetchPairs = async () => {
const res = await api.post('/api/explore');
return res.data;
};
const fetchPairs = explorePage.getDrugChemicalPairs;

export default function DrugDiseasePairs() {
const [pairs, setPairs] = React.useState([]);
Expand Down

0 comments on commit a8d6e55

Please sign in to comment.