Fix null pointer exception

This commit is contained in:
Björn Fromme
2022-03-14 12:39:48 +01:00
parent b1b4da769f
commit 520d2ea4ee
@@ -70,12 +70,14 @@ export default class extends Controller {
this.loadingValue = true this.loadingValue = true
this.priceTableContainerTarget.innerHTML = '' this.priceTableContainerTarget.innerHTML = ''
this.modeValue = 'prices' this.modeValue = 'prices'
let paCode = this.getConfig().paCode
let dateUid = e.currentTarget.dataset.dateUid let dateUid = e.currentTarget.dataset.dateUid
const data = new URLSearchParams({ const data = new URLSearchParams({
'tx_epproducts_ajax[date]': dateUid, 'tx_epproducts_ajax[date]': dateUid,
'tx_epproducts_ajax[paCode]': paCode,
}) })
let paCode = this.getConfig().paCode
if (paCode) {
data.append('tx_epproducts_ajax[paCode]', paCode)
}
fetch(this.pricetableUriValue, { method: 'POST', body: data }) fetch(this.pricetableUriValue, { method: 'POST', body: data })
.then(this.checkStatus) .then(this.checkStatus)
.then(this.parseHTML) .then(this.parseHTML)