bugfixes 🐛

This commit is contained in:
Jannis R 2016-07-18 19:21:31 +02:00
parent 2572b9a42d
commit 5f4509d89d
2 changed files with 5 additions and 4 deletions

View file

@ -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 || {}

View file

@ -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