Skip to content

Commit c36b5a7

Browse files
amarant-commerceIvan Rogar
authored andcommitted
FIXED array query params
1 parent 1e04c97 commit c36b5a7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/templates/core/functions/getQueryString.hbs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ export const getQueryString = (params: Record<string, any>): string => {
88
const process = (key: string, value: any) => {
99
if (isDefined(value)) {
1010
if (Array.isArray(value)) {
11-
value.forEach(v => {
12-
process(key, v);
13-
});
11+
// preserve indexes for array type query params
12+
let newValue = {};
13+
value.forEach((v, i) => {
14+
newValue[i] = v;
15+
});
16+
17+
process(key, newValue);
1418
} else if (typeof value === 'object') {
1519
Object.entries(value).forEach(([k, v]) => {
1620
process(`${key}[${k}]`, v);

0 commit comments

Comments
 (0)