Skip to content

Commit

Permalink
mapbox#232 - added exclude parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Beso Bantsadze committed Dec 18, 2019
1 parent 236871f commit 9008392
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function setHoverMarker(feature) {

function fetchDirections() {
return (dispatch, getState) => {
const { api, accessToken, routeIndex, profile, alternatives, congestion, destination, language } = getState();
const { api, accessToken, routeIndex, profile, alternatives, congestion, destination, language, exclude } = getState();
// if there is no destination set, do not make request because it will fail
if (!(destination && destination.geometry)) return;

Expand All @@ -66,6 +66,7 @@ function fetchDirections() {
options.push('steps=true');
options.push('overview=full');
if (language) options.push('language='+language);
if (exclude) options.push('exclude=' + exclude);
if (accessToken) options.push('access_token=' + accessToken);
request.abort();
request.open('GET', `${api}${profile}/${query}.json?${options.join('&')}`, true);
Expand Down
1 change: 1 addition & 0 deletions src/directions.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import Instructions from './controls/instructions';
* @param {String} [options.placeholderOrigin="Choose a starting place"] If set, this text will appear as the placeholder attribute for the origin input element.
* @param {String} [options.placeholderDestination="Choose destination"] If set, this text will appear as the placeholder attribute for the destination input element.
* @param {Boolean} [options.flyTo=true] If false, animating the map to a selected result is disabled.
* @param {String} [options.exclude=null] Exclude certain road types from routing. The default is to not exclude anything. Search for `exclude` in `optional parameters`: https://docs.mapbox.com/api/navigation/#retrieve-directions
* @example
* var MapboxDirections = require('../src/index');
* var directions = new MapboxDirections({
Expand Down

0 comments on commit 9008392

Please sign in to comment.