@@ -124,8 +124,8 @@ export function routingQuery (searchId = null, updateSearchInReducer = false) {
124
124
return Promise . all ( iterations . map ( ( injectedParams , i ) => {
125
125
const requestId = randId ( )
126
126
// fetch a realtime route
127
- const query = constructRoutingQuery ( state , false , injectedParams )
128
- const realTimeFetch = fetch ( query , getOtpFetchOptions ( state ) )
127
+ const url = constructRoutingQuery ( state , false , injectedParams )
128
+ const realTimeFetch = fetch ( url , getOtpFetchOptions ( state ) )
129
129
. then ( getJsonAndCheckResponse )
130
130
. then ( json => {
131
131
const dispatchedRoutingResponse = dispatch ( routingResponse ( {
@@ -143,12 +143,12 @@ export function routingQuery (searchId = null, updateSearchInReducer = false) {
143
143
if ( ! isStoredPlace ( to ) ) {
144
144
dispatch ( rememberPlace ( { location : formatRecentPlace ( to ) , type : 'recent' } ) )
145
145
}
146
- dispatch ( rememberSearch ( formatRecentSearch ( query , state ) ) )
146
+ dispatch ( rememberSearch ( formatRecentSearch ( url , state ) ) )
147
147
}
148
148
return dispatchedRoutingResponse
149
149
} )
150
150
. catch ( error => {
151
- dispatch ( routingError ( { error, requestId, searchId } ) )
151
+ dispatch ( routingError ( { error, requestId, searchId, url } ) )
152
152
} )
153
153
// Update OTP URL params if a new search. In other words, if we're
154
154
// performing a search based on query params taken from the URL after a back
@@ -328,84 +328,6 @@ export function findStop (params) {
328
328
)
329
329
}
330
330
331
- // TODO: Optionally substitute GraphQL queries? Note: this is not currently
332
- // possible because gtfsdb (the alternative transit index used by TriMet) does not
333
- // support GraphQL queries.
334
- // export function findStop (params) {
335
- // const query = `
336
- // query stopQuery($stopId: [String]) {
337
- // stops (ids: $stopId) {
338
- // id: gtfsId
339
- // code
340
- // name
341
- // url
342
- // lat
343
- // lon
344
- // stoptimesForPatterns {
345
- // pattern {
346
- // id: semanticHash
347
- // route {
348
- // id: gtfsId
349
- // longName
350
- // shortName
351
- // sortOrder
352
- // }
353
- // }
354
- // stoptimes {
355
- // scheduledArrival
356
- // realtimeArrival
357
- // arrivalDelay
358
- // scheduledDeparture
359
- // realtimeDeparture
360
- // departureDelay
361
- // timepoint
362
- // realtime
363
- // realtimeState
364
- // serviceDay
365
- // headsign
366
- // }
367
- // }
368
- // }
369
- // }
370
- // `
371
- // return createGraphQLQueryAction(
372
- // query,
373
- // { stopId: params.stopId },
374
- // findStopResponse,
375
- // findStopError,
376
- // {
377
- // // find stop should not be throttled since it can make quite frequent
378
- // // updates when fetching stop times for a stop
379
- // noThrottle: true,
380
- // serviceId: 'stops',
381
- // rewritePayload: (payload) => {
382
- // // convert pattern array to ID-mapped object
383
- // const patterns = []
384
- // const { stoptimesForPatterns, ...stop } = payload.data.stops[0]
385
- // stoptimesForPatterns.forEach(obj => {
386
- // const { pattern, stoptimes: stopTimes } = obj
387
- // // It's possible that not all stop times for a pattern will share the
388
- // // same headsign, but this is probably a minor edge case.
389
- // const headsign = stopTimes[0]
390
- // ? stopTimes[0].headsign
391
- // : pattern.route.longName
392
- // const patternIndex = patterns.findIndex(p =>
393
- // p.headsign === headsign && pattern.route.id === p.route.id)
394
- // if (patternIndex === -1) {
395
- // patterns.push({ ...pattern, headsign, stopTimes })
396
- // } else {
397
- // patterns[patternIndex].stopTimes.push(...stopTimes)
398
- // }
399
- // })
400
- // return {
401
- // ...stop,
402
- // patterns
403
- // }
404
- // }
405
- // }
406
- // )
407
- // }
408
-
409
331
// Single trip lookup query
410
332
411
333
export const findTripResponse = createAction ( 'FIND_TRIP_RESPONSE' )
@@ -558,45 +480,6 @@ export function findRoutes (params) {
558
480
)
559
481
}
560
482
561
- // export function findRoutes (params) {
562
- // const query = `
563
- // {
564
- // routes {
565
- // id: gtfsId
566
- // color
567
- // longName
568
- // shortName
569
- // mode
570
- // type
571
- // desc
572
- // bikesAllowed
573
- // sortOrder
574
- // textColor
575
- // url
576
- // agency {
577
- // id: gtfsId
578
- // name
579
- // url
580
- // }
581
- // }
582
- // }
583
- // `
584
- // return createGraphQLQueryAction(
585
- // query,
586
- // {},
587
- // findRoutesResponse,
588
- // findRoutesError,
589
- // {
590
- // serviceId: 'routes',
591
- // rewritePayload: (payload) => {
592
- // const routes = {}
593
- // payload.data.routes.forEach(rte => { routes[rte.id] = rte })
594
- // return routes
595
- // }
596
- // }
597
- // )
598
- // }
599
-
600
483
// Patterns for Route lookup query
601
484
// TODO: replace with GraphQL query for route => patterns => geometry
602
485
const findPatternsForRouteResponse = createAction ( 'FIND_PATTERNS_FOR_ROUTE_RESPONSE' )
@@ -673,51 +556,6 @@ export function findGeometryForPattern (params) {
673
556
)
674
557
}
675
558
676
- // export function findRoute (params) {
677
- // const query = `
678
- // query routeQuery($routeId: [String]) {
679
- // routes (ids: $routeId) {
680
- // id: gtfsId
681
- // patterns {
682
- // id: semanticHash
683
- // directionId
684
- // headsign
685
- // name
686
- // semanticHash
687
- // geometry {
688
- // lat
689
- // lon
690
- // }
691
- // }
692
- // }
693
- // }
694
- // `
695
- // return createGraphQLQueryAction(
696
- // query,
697
- // { routeId: params.routeId },
698
- // findPatternsForRouteResponse,
699
- // findPatternsForRouteError,
700
- // {
701
- // rewritePayload: (payload) => {
702
- // // convert pattern array to ID-mapped object
703
- // const patterns = {}
704
- // payload.data.routes[0].patterns.forEach(ptn => {
705
- // patterns[ptn.id] = {
706
- // routeId: params.routeId,
707
- // patternId: ptn.id,
708
- // geometry: ptn.geometry
709
- // }
710
- // })
711
- //
712
- // return {
713
- // routeId: params.routeId,
714
- // patterns
715
- // }
716
- // }
717
- // }
718
- // )
719
- // }
720
-
721
559
// TNC ETA estimate lookup query
722
560
723
561
export const transportationNetworkCompanyEtaResponse = createAction ( 'TNC_ETA_RESPONSE' )
0 commit comments