Skip to content

Commit

Permalink
feat(gadm): add source provider and source version to v2/area endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
willian-viana committed Jan 16, 2025
1 parent a690c02 commit 2c9f07d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions services/areas.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { apiAuthRequest } from 'utils/request';
import { trackEvent } from 'utils/analytics';

const REQUEST_URL = '/v2/area';
const SOURCE = `?source[provider]=gadm&source[version]=3.6`; // these values will come from Redux

export const getArea = (id, userToken = null) =>
apiAuthRequest
.get(`${REQUEST_URL}/${id}`, {
.get(`${REQUEST_URL}/${id}${SOURCE}`, {
headers: {
...(userToken && {
Authorization: `Bearer ${userToken}`,
Expand Down Expand Up @@ -36,7 +37,7 @@ export const getArea = (id, userToken = null) =>
});

export const getAreas = () =>
apiAuthRequest.get(REQUEST_URL).then((areasResponse) => {
apiAuthRequest.get(`${REQUEST_URL}${SOURCE}`).then((areasResponse) => {
const { data: areas } = areasResponse.data;

return areas.map((area) => {
Expand Down

0 comments on commit 2c9f07d

Please sign in to comment.