Fix: Don't append paCode when null

This commit is contained in:
Björn Fromme
2023-07-05 15:50:40 +02:00
parent 35cfa92b43
commit 3d0a1d86e6
2 changed files with 7 additions and 3 deletions
@@ -71,7 +71,7 @@ class BookingUrlUtility
} }
} }
if ($paCode) { if (null !== $paCode) {
$query['agenturcode'] = $paCode; $query['agenturcode'] = $paCode;
} elseif ($bpnCookie) { } elseif ($bpnCookie) {
$query['agenturcode'] = $bpnCookie; $query['agenturcode'] = $bpnCookie;
@@ -53,7 +53,9 @@ export default class extends Controller {
this.loadingValue = true this.loadingValue = true
let paCode = this.getConfig().paCode let paCode = this.getConfig().paCode
const data = new URLSearchParams() const data = new URLSearchParams()
data.append('pa', paCode) if (null !== paCode) {
data.append('pa', paCode)
}
this.datesTableContainerTarget.innerHTML = '' this.datesTableContainerTarget.innerHTML = ''
fetch(`${this.datestableUriValue}&${data}`) fetch(`${this.datestableUriValue}&${data}`)
.then(this.checkStatus) .then(this.checkStatus)
@@ -73,7 +75,9 @@ export default class extends Controller {
this.modeValue = 'prices' this.modeValue = 'prices'
let paCode = this.getConfig().paCode let paCode = this.getConfig().paCode
const data = new URLSearchParams() const data = new URLSearchParams()
data.append('pa', paCode) if (null !== paCode) {
data.append('pa', paCode)
}
fetch(`${params.pricesUrl}&${data}`) fetch(`${params.pricesUrl}&${data}`)
.then(this.checkStatus) .then(this.checkStatus)
.then(this.parseHTML) .then(this.parseHTML)