Skip to content
Snippets Groups Projects
Commit f833ea5a authored by lcottret's avatar lcottret
Browse files

Merge branch 'hotfix/changeUrl'

parents bd65d973 66828dc2
No related branches found
Tags 0.1.1
No related merge requests found
Pipeline #277492 passed
...@@ -3,16 +3,15 @@ import { TaxonomyItem } from "@/types/TaxonomyItem"; ...@@ -3,16 +3,15 @@ import { TaxonomyItem } from "@/types/TaxonomyItem";
import { TaxonTree } from "@/types/TaxonTree"; import { TaxonTree } from "@/types/TaxonTree";
import axios from "axios"; import axios from "axios";
const BASE_URL = "https://metexplore.toulouse.inrae.fr/mth-ncbi-taxonomy-api";
export function useApiService() { export function useApiService() {
async function getChildren( async function getChildren(
parentTaxId: string, parentTaxId: string,
): Promise<TaxonomyList | null> { ): Promise<TaxonomyList | null> {
const result = await axios.get( const result = await axios.get(`${BASE_URL}/children`, {
"http://147.100.181.110/mth-ncbi-taxonomy-api/children", params: { id: parentTaxId },
{ });
params: { id: parentTaxId },
},
);
if (result.data.success) { if (result.data.success) {
// transform into a TaxonomyList object // transform into a TaxonomyList object
const tmp: TaxonomyList = {}; const tmp: TaxonomyList = {};
...@@ -30,15 +29,12 @@ export function useApiService() { ...@@ -30,15 +29,12 @@ export function useApiService() {
} }
async function getLineage(taxName: string): Promise<TaxonomyItem[] | null> { async function getLineage(taxName: string): Promise<TaxonomyItem[] | null> {
const result = await axios.get( const result = await axios.get(`${BASE_URL}/lineage_by_taxname`, {
"http://147.100.181.110/mth-ncbi-taxonomy-api/lineage_by_taxname", params: { name: taxName },
{ paramsSerializer: {
params: { name: taxName }, encode: (param) => encodeURIComponent(param).replace("+", "%20"),
paramsSerializer: {
encode: (param) => encodeURIComponent(param).replace("+", "%20"),
},
}, },
); });
if (result.data.success) { if (result.data.success) {
// transform into a TaxonomyItem[] object // transform into a TaxonomyItem[] object
const tmp: TaxonomyItem[] = []; const tmp: TaxonomyItem[] = [];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment