mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
journeys: async fn -> .then, don't check profile.journeysNumF 🐛
This commit is contained in:
parent
71db75df93
commit
2c04e2f728
1 changed files with 16 additions and 17 deletions
11
index.js
11
index.js
|
@ -82,7 +82,7 @@ const createClient = (profile, userAgent, opt = {}) => {
|
||||||
return _stationBoard(station, 'ARR', profile.parseArrival, opt)
|
return _stationBoard(station, 'ARR', profile.parseArrival, opt)
|
||||||
}
|
}
|
||||||
|
|
||||||
const journeys = async (from, to, opt = {}) => {
|
const journeys = (from, to, opt = {}) => {
|
||||||
from = profile.formatLocation(profile, from, 'from')
|
from = profile.formatLocation(profile, from, 'from')
|
||||||
to = profile.formatLocation(profile, to, 'to')
|
to = profile.formatLocation(profile, to, 'to')
|
||||||
|
|
||||||
|
@ -198,17 +198,15 @@ const createClient = (profile, userAgent, opt = {}) => {
|
||||||
query.outDate = profile.formatDate(profile, when)
|
query.outDate = profile.formatDate(profile, when)
|
||||||
query.outTime = profile.formatTime(profile, when)
|
query.outTime = profile.formatTime(profile, when)
|
||||||
}
|
}
|
||||||
if (profile.journeysNumF && opt.results !== null) query.numF = opt.results
|
if (opt.results !== null) query.numF = opt.results
|
||||||
if (profile.journeysOutFrwd) query.outFrwd = outFrwd
|
if (profile.journeysOutFrwd) query.outFrwd = outFrwd
|
||||||
|
|
||||||
const {
|
return profile.request({profile, opt}, userAgent, {
|
||||||
res, common,
|
|
||||||
} = await profile.request({profile, opt}, userAgent, {
|
|
||||||
cfg: {polyEnc: 'GPA'},
|
cfg: {polyEnc: 'GPA'},
|
||||||
meth: 'TripSearch',
|
meth: 'TripSearch',
|
||||||
req: profile.transformJourneysQuery({profile, opt}, query)
|
req: profile.transformJourneysQuery({profile, opt}, query)
|
||||||
})
|
})
|
||||||
|
.then(({res, common}) => {
|
||||||
if (!Array.isArray(res.outConL)) return []
|
if (!Array.isArray(res.outConL)) return []
|
||||||
// todo: outConGrpL
|
// todo: outConGrpL
|
||||||
|
|
||||||
|
@ -222,6 +220,7 @@ const createClient = (profile, userAgent, opt = {}) => {
|
||||||
journeys,
|
journeys,
|
||||||
realtimeDataFrom: res.planrtTS ? parseInt(res.planrtTS) : null,
|
realtimeDataFrom: res.planrtTS ? parseInt(res.planrtTS) : null,
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const refreshJourney = (refreshToken, opt = {}) => {
|
const refreshJourney = (refreshToken, opt = {}) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue