Skip to content

Commit

Permalink
Change name for new backend
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelStardust committed Sep 18, 2024
1 parent 8cb5f6d commit 14ae6f4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/pages/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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'));
}
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -65,7 +65,7 @@ export class ForestLossPersistenceController {
polygon: polygonFeature | null
): Promise<ForestLPData> => {
if (searchType === "drawPolygon") {
return BackendStacAPI.requestForestLPData(polygon)
return SearchAPI.requestForestLPData(polygon)
.then((data: ForestLPRawDataPolygon[]) => {
const rawData: Array<ForestLPRawDataPolygon> = data;
const periods: Array<string> = [
Expand Down
10 changes: 5 additions & 5 deletions src/utils/backendStacAPI.ts → src/utils/searchAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Array<String>> {
return backendStacAPI.makeGetRequest(`docs`);
return SearchAPI.makeGetRequest(`docs`);
}

/**
Expand All @@ -24,7 +24,7 @@ class backendStacAPI {
polygon: polygon,
};

return backendStacAPI.makePostRequest(
return SearchAPI.makePostRequest(
"metrics/LossPersistence/values",
requestBody,
{ responseType: "json" },
Expand All @@ -50,7 +50,7 @@ class backendStacAPI {
};

return {
request: backendStacAPI.makePostRequest(
request: SearchAPI.makePostRequest(
`metrics/LossPersistence/layer?item_id=${period}`,
requestBody,
{ responseType: "arraybuffer" },
Expand Down Expand Up @@ -135,4 +135,4 @@ class backendStacAPI {
}
}

export default backendStacAPI;
export default SearchAPI;

0 comments on commit 14ae6f4

Please sign in to comment.