fix broken logic in err reporting

pull/1/head
Ondřej Hruška 7 years ago
parent c8305dea1a
commit cf29deaa0c
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 4
      js/appcommon.js

@ -100,14 +100,16 @@ $.ready(function () {
let errs = decodeURIComponent(window.location.search.substr(msgAt + 4)).split(',') let errs = decodeURIComponent(window.location.search.substr(msgAt + 4)).split(',')
let humanReadableErrors = [] let humanReadableErrors = []
errs.forEach(function (er) { errs.forEach(function (er) {
if (er.length === 0) return
let lbls = qsa('label[for="' + er + '"]') let lbls = qsa('label[for="' + er + '"]')
if (lbls) { if (lbls && lbls.length > 0) {
for (let i = 0; i < lbls.length; i++) { for (let i = 0; i < lbls.length; i++) {
let lbl = lbls[i] let lbl = lbls[i]
lbl.classList.add('error') lbl.classList.add('error')
if (i === 0) humanReadableErrors.push(lbl.childNodes[0].textContent.trim().replace(/: ?$/, '')) if (i === 0) humanReadableErrors.push(lbl.childNodes[0].textContent.trim().replace(/: ?$/, ''))
} }
} else { } else {
console.log(JSON.stringify(er))
humanReadableErrors.push(er) humanReadableErrors.push(er)
} }
}) })

Loading…
Cancel
Save