@@ -41,15 +41,15 @@ class SettingsSelectorPanel extends Component {
4141
4242 _setBikeOnly = ( ) => { this . _setSoloMode ( 'BICYCLE' ) }
4343
44- _setOwnBike = ( ) => {
45- const nonBikeModes = this . props . queryModes . filter ( m => ! m . startsWith ( 'BICYCLE' ) )
46- this . props . setQueryParam ( { mode : 'BICYCLE,' + nonBikeModes . join ( ',' ) } )
44+ _addBikeModeToQueryModes = ( bikeMode ) => {
45+ const { queryModes, setQueryParam } = this . props
46+ const nonBikeModes = queryModes . filter ( m => ! m . startsWith ( 'BICYCLE' ) )
47+ setQueryParam ( { mode : [ ...nonBikeModes , bikeMode ] . join ( ',' ) } )
4748 }
4849
49- _setRentedBike = ( ) => {
50- const nonBikeModes = this . props . queryModes . filter ( m => ! m . startsWith ( 'BICYCLE' ) )
51- this . props . setQueryParam ( { mode : 'BICYCLE_RENT,' + nonBikeModes . join ( ',' ) } )
52- }
50+ _setOwnBike = ( ) => this . _addBikeModeToQueryModes ( 'BICYCLE' )
51+
52+ _setRentedBike = ( ) => this . _addBikeModeToQueryModes ( 'BICYCLE_RENT' )
5353
5454 _toggleTransitMode ( mode ) {
5555 const modeStr = mode . mode || mode
@@ -86,13 +86,17 @@ class SettingsSelectorPanel extends Component {
8686 }
8787
8888 // If no transit modes selected, select all
89- if ( ! queryModes || queryModes . length === 0 ) queryModes = getTransitModes ( this . props . config )
89+ if ( ! queryModes || queryModes . length === 0 ) {
90+ queryModes = getTransitModes ( this . props . config )
91+ }
9092
9193 // Add the access mode
9294 queryModes . push ( modeStr )
9395
9496 // Do extra stuff if mode selected was a TNC
95- queryParamUpdate . companies = ( modeStr === 'CAR_HAIL' || modeStr === 'CAR_RENT' ) ? mode . company . toUpperCase ( ) : null
97+ queryParamUpdate . companies = ( modeStr === 'CAR_HAIL' || modeStr === 'CAR_RENT' )
98+ ? mode . company . toUpperCase ( )
99+ : null
96100
97101 queryParamUpdate . mode = queryModes . join ( ',' )
98102
0 commit comments