diff --git a/src/pages/Search.jsx b/src/pages/Search.jsx index de939cbdc..ab79fdfd8 100644 --- a/src/pages/Search.jsx +++ b/src/pages/Search.jsx @@ -15,7 +15,7 @@ import isUndefinedOrNull from 'utils/validations'; import GeoServerAPI from 'utils/geoServerAPI'; import matchColor from 'utils/matchColor'; import RestAPI from 'utils/restAPI'; -import BackendStacAPI from 'utils/backendStacAPI'; +import SearchAPI from 'utils/searchAPI'; import BackendAPI from 'utils/backendAPI'; import GradientLegend from 'pages/search/shared_components/GradientLegend'; import MapViewer from 'pages/search/MapViewer'; @@ -161,7 +161,7 @@ class Search extends Component { * Get the current list of scripts at BIAB backend. It is used to check connection to backend. */ checkPolygonConn = () => { - BackendStacAPI.requestTestBackend() + SearchAPI.requestTestBackend() .then(() => this.reportNoMessage('polygon')) .catch(() => this.reportConnError('polygon')); } @@ -766,7 +766,7 @@ class Search extends Component { } else if (/forestLP-*/.test(layerName)) { const [, yearIni, yearEnd, category] = layerName.match(/forestLP-(\w+)-(\w+)-(\w+)/); if (searchType === "drawPolygon") { - reqPromise = () => BackendStacAPI.requestForestLPLayer(`${yearIni}-${yearEnd}`, polygon.geojson); + reqPromise = () => SearchAPI.requestForestLPLayer(`${yearIni}-${yearEnd}`, polygon.geojson); } else { reqPromise = () => RestAPI.requestForestLPLayer( selectedAreaTypeId, diff --git a/src/pages/search/drawer/landscape/forest/ForestLossPersistenceController.ts b/src/pages/search/drawer/landscape/forest/ForestLossPersistenceController.ts index 63dc79b1e..9fb47bd1a 100644 --- a/src/pages/search/drawer/landscape/forest/ForestLossPersistenceController.ts +++ b/src/pages/search/drawer/landscape/forest/ForestLossPersistenceController.ts @@ -3,7 +3,7 @@ import { SmallBarsDataDetails, } from "pages/search/shared_components/charts/SmallBars"; import BackendAPI from "utils/backendAPI"; -import BackendStacAPI from "utils/backendStacAPI"; +import SearchAPI from "utils/searchAPI"; import { ForestLPExt, ForestLPRawDataPolygon, @@ -65,7 +65,7 @@ export class ForestLossPersistenceController { polygon: polygonFeature | null ): Promise => { if (searchType === "drawPolygon") { - return BackendStacAPI.requestForestLPData(polygon) + return SearchAPI.requestForestLPData(polygon) .then((data: ForestLPRawDataPolygon[]) => { const rawData: Array = data; const periods: Array = [ diff --git a/src/utils/backendStacAPI.ts b/src/utils/searchAPI.ts similarity index 94% rename from src/utils/backendStacAPI.ts rename to src/utils/searchAPI.ts index 8b6c4c1b0..18ff21424 100644 --- a/src/utils/backendStacAPI.ts +++ b/src/utils/searchAPI.ts @@ -2,12 +2,12 @@ import axios, { AxiosRequestConfig } from "axios"; import { polygonFeature } from "pages/search/types/drawer"; import { ForestLPRawDataPolygon } from "pages/search/types/forest"; -class backendStacAPI { +class SearchAPI { /** * Get the list of current scripts. */ static requestTestBackend(): Promise> { - return backendStacAPI.makeGetRequest(`docs`); + return SearchAPI.makeGetRequest(`docs`); } /** @@ -24,7 +24,7 @@ class backendStacAPI { polygon: polygon, }; - return backendStacAPI.makePostRequest( + return SearchAPI.makePostRequest( "metrics/LossPersistence/values", requestBody, { responseType: "json" }, @@ -50,7 +50,7 @@ class backendStacAPI { }; return { - request: backendStacAPI.makePostRequest( + request: SearchAPI.makePostRequest( `metrics/LossPersistence/layer?item_id=${period}`, requestBody, { responseType: "arraybuffer" }, @@ -135,4 +135,4 @@ class backendStacAPI { } } -export default backendStacAPI; +export default SearchAPI;