Skip to content

Commit da8c67d

Browse files
authored
do not make directions api request if there is no set destination (#165)
1 parent 31c7911 commit da8c67d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/actions/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ function setHoverMarker(feature) {
5252

5353
function fetchDirections() {
5454
return (dispatch, getState) => {
55-
const { api, accessToken, routeIndex, profile, alternatives, congestion } = getState();
55+
const { api, accessToken, routeIndex, profile, alternatives, congestion, destination } = getState();
56+
// if there is no destination set, do not make request because it will fail
57+
if (!(destination && destination.geometry)) return;
58+
5659
const query = buildDirectionsQuery(getState);
5760

5861
// Request params

0 commit comments

Comments
 (0)