@@ -24,20 +24,16 @@ export function addStopAtPoint (latlng, addToPattern = false, index, activePatte
24
24
return function ( dispatch , getState ) {
25
25
// create stop
26
26
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 ) )
29
28
. then ( s => {
30
29
const gtfsStop = stopToGtfs ( s )
31
30
// add stop to end of pattern
32
31
if ( addToPattern && gtfsStop ) {
33
32
return dispatch ( addStopToPattern ( activePattern , gtfsStop , index ) )
34
- . then ( result => {
35
- return gtfsStop
36
- } )
33
+ . then ( result => gtfsStop )
37
34
}
38
35
return gtfsStop
39
- } )
40
- } )
36
+ } ) )
41
37
}
42
38
}
43
39
@@ -163,9 +159,10 @@ export function addStopToPattern (pattern, stop, index) {
163
159
if ( coordinates ) {
164
160
const endPoint = ll . toLeaflet ( coordinates [ coordinates . length - 1 ] )
165
161
patternStops . push ( newStop )
166
- dispatch ( updateActiveGtfsEntity ( pattern , 'trippattern' , { patternStops : patternStops } ) )
162
+ dispatch ( updateActiveGtfsEntity ( pattern , 'trippattern' , { patternStops} ) )
167
163
// 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} ) )
169
166
} else {
170
167
// if shape coordinates do not exist, add pattern stop and get shape between stops (if multiple stops exist)
171
168
patternStops . push ( newStop )
0 commit comments