SSR-1632 Don't pass null values
This commit is contained in:
parent
edd1dcc4f8
commit
5b72a3fddd
1 changed files with 6 additions and 1 deletions
|
|
@ -47,11 +47,16 @@ export function getTaxLineItemQueryString(lineItems, parameterName) {
|
|||
export function buildURLSearchParams(data) {
|
||||
const params = new URLSearchParams();
|
||||
Object.entries(data).forEach(([key, value]) => {
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach((arrayValue, index) => {
|
||||
if (typeof value === 'object') {
|
||||
Object.entries(arrayValue).forEach(([objectKey, objectValue]) => {
|
||||
params.append(`${key}[${index}].${objectKey}`, `${objectValue}`);
|
||||
if (objectValue != null) {
|
||||
params.append(`${key}[${index}].${objectKey}`, `${objectValue}`);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
params.append(`${key}[${index}]`, `${value}`);
|
||||
|
|
|
|||
Loading…
Reference in a new issue