Skip to content

Commit

Permalink
Merge pull request #24 from dscdut/feat/change_to_mapbox
Browse files Browse the repository at this point in the history
fix(map): encode the api key in uri
  • Loading branch information
High10Hunter authored Sep 21, 2024
2 parents e32eeea + f97aeb6 commit fb0d1af
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/modules/maps/services/providers/mapbox.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class MapBoxService implements IMapService {
const { address, key } = request.params;
const url = `${this.MAPBOX_GEOCODE_API_URL}/forward?q=${encodeURIComponent(
address,
)}&access_token=${key}`;
)}&access_token=${encodeURIComponent(key)}`;

try {
const response = await axios.get(url);
Expand Down Expand Up @@ -51,7 +51,11 @@ export class MapBoxService implements IMapService {
`${destination.lng},${destination.lat}`,
].join(';');

const url = `${this.MAPBOX_OPTIMIZED_ROUTE_API_URL}/mapbox/driving/${coordinates}?source=first&destination=last&roundtrip=false&access_token=${key}&overview=full`;
const url = `${
this.MAPBOX_OPTIMIZED_ROUTE_API_URL
}/mapbox/driving/${coordinates}?source=first&destination=last&roundtrip=false&access_token=${encodeURIComponent(
key,
)}&overview=full`;

try {
const response = await axios.get(url);
Expand Down

0 comments on commit fb0d1af

Please sign in to comment.