mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-22 22:59:35 +02:00
bugfixes 🐛
This commit is contained in:
parent
2572b9a42d
commit
5f4509d89d
2 changed files with 5 additions and 4 deletions
6
index.js
6
index.js
|
@ -34,9 +34,9 @@ const request = (opt) => {
|
|||
.then((res) => {
|
||||
const b = res.body
|
||||
|
||||
if (b.err) return new Error(b.err)
|
||||
if (!b.svcResL || !b.svcResL[0]) return new Error('invalid response')
|
||||
if (b.svcResL[0].err !== 'OK') return new Error(b.svcResL[0].errTxt)
|
||||
if (b.err) throw new Error(b.err)
|
||||
if (!b.svcResL || !b.svcResL[0]) throw new Error('invalid response')
|
||||
if (b.svcResL[0].err !== 'OK') throw new Error(b.svcResL[0].errTxt)
|
||||
const d = b.svcResL[0].res
|
||||
const c = d.common || {}
|
||||
|
||||
|
|
3
parse.js
3
parse.js
|
@ -86,7 +86,8 @@ const part = (tz, s, p, r, c) => (pt) => {
|
|||
result.product = p[parseInt(pt.jny.prodX)]
|
||||
result.direction = pt.jny.dirTxt // todo: parse this
|
||||
if (pt.jny.stopL) result.passed = pt.jny.stopL.map(stop(tz, s, p, r, c))
|
||||
pt.jny.remL.forEach(applyRemark(s, p, r, c))
|
||||
if (Array.isArray(pt.jny.remL))
|
||||
pt.jny.remL.forEach(applyRemark(s, p, r, c))
|
||||
|
||||
if (pt.jny.freq && pt.jny.freq.jnyL)
|
||||
result.alternatives = pt.jny.freq.jnyL
|
||||
|
|
Loading…
Add table
Reference in a new issue