@@ -24,20 +24,16 @@ export function addStopAtPoint (latlng, addToPattern = false, index, activePatte
2424 return function ( dispatch , getState ) {
2525 // create stop
2626 return constructStop ( latlng , activePattern . feedId )
27- . then ( stop => {
28- return dispatch ( newGtfsEntity ( activePattern . feedId , 'stop' , stop , true ) )
27+ . then ( stop => dispatch ( newGtfsEntity ( activePattern . feedId , 'stop' , stop , true ) )
2928 . then ( s => {
3029 const gtfsStop = stopToGtfs ( s )
3130 // add stop to end of pattern
3231 if ( addToPattern && gtfsStop ) {
3332 return dispatch ( addStopToPattern ( activePattern , gtfsStop , index ) )
34- . then ( result => {
35- return gtfsStop
36- } )
33+ . then ( result => gtfsStop )
3734 }
3835 return gtfsStop
39- } )
40- } )
36+ } ) )
4137 }
4238}
4339
@@ -163,9 +159,10 @@ export function addStopToPattern (pattern, stop, index) {
163159 if ( coordinates ) {
164160 const endPoint = ll . toLeaflet ( coordinates [ coordinates . length - 1 ] )
165161 patternStops . push ( newStop )
166- dispatch ( updateActiveGtfsEntity ( pattern , 'trippattern' , { patternStops : patternStops } ) )
162+ dispatch ( updateActiveGtfsEntity ( pattern , 'trippattern' , { patternStops} ) )
167163 // saveActiveGtfsEntity('trippattern')
168- return dispatch ( extendPatternToPoint ( pattern , endPoint , { lng : stop . stop_lon , lat : stop . stop_lat } ) )
164+ const { stop_lon : lng , stop_lat : lat } = stop
165+ return dispatch ( extendPatternToPoint ( pattern , endPoint , { lng, lat} ) )
169166 } else {
170167 // if shape coordinates do not exist, add pattern stop and get shape between stops (if multiple stops exist)
171168 patternStops . push ( newStop )
0 commit comments