Skip to content

Commit

Permalink
fix(switch-button): automatically re-plan after clicking
Browse files Browse the repository at this point in the history
  • Loading branch information
miles-grant-ibigroup committed Nov 17, 2021
1 parent be63c21 commit f520d19
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/actions/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,19 @@ export function setLocationToCurrent (payload) {
}

export function switchLocations () {
return function (dispatch, getState) {
return async function (dispatch, getState) {
const { from, to } = getState().otp.currentQuery
// First, reverse the locations.
dispatch(settingLocation({
await dispatch(settingLocation({
location: to,
locationType: 'from'
}))
dispatch(settingLocation({
await dispatch(settingLocation({
location: from,
locationType: 'to'
}))
// Then kick off a routing query (if the query is invalid, search will abort).
dispatch(routingQuery())
return dispatch(routingQuery())
}
}

Expand Down

0 comments on commit f520d19

Please sign in to comment.