Ю
Size: a a a
S
I
Ю
D4
async function fetchRecursive(base_url, arr) {
const result = [];
if (Array.isArray(arr))
for (const n of arr) {
if (n.children) {
let ch_arr;
try {
result.push({
id: n.id,
externalId: n.externalId,
text: n.text,
children: await fetch(base_url + n.id).then((r) => {
ch_arr = { ...r };
return r.json();
}),
productCount: n.productCount,
});
} catch (error) {
result.push({ id: n.id, error });
}
result.push(...(await fetchRecursive(base_url, ch_arr)));
} else {
result.push(n);
}
}
return result;
}
{id: 13661, externalId: "КЗ000000000000002853", text: "J-Y (ST) Y", children: false, productCount: 3}
D4
S
async function fetchRecursive(base_url, arr) {
const result = [];
if (Array.isArray(arr))
for (const n of arr) {
if (n.children) {
let ch_arr;
try {
result.push({
id: n.id,
externalId: n.externalId,
text: n.text,
children: await fetch(base_url + n.id).then((r) => {
ch_arr = { ...r };
return r.json();
}),
productCount: n.productCount,
});
} catch (error) {
result.push({ id: n.id, error });
}
result.push(...(await fetchRecursive(base_url, ch_arr)));
} else {
result.push(n);
}
}
return result;
}
{id: 13661, externalId: "КЗ000000000000002853", text: "J-Y (ST) Y", children: false, productCount: 3}
A
D4
D4
S
D4
NL
S
async function fetchRecursive(base_url, arr) {
const result = [];
if (Array.isArray(arr))
for (const n of arr) {
if (n.children) {
let ch_arr;
try {
result.push({
id: n.id,
externalId: n.externalId,
text: n.text,
children: await fetch(base_url + n.id).then((r) => {
ch_arr = { ...r };
return r.json();
}),
productCount: n.productCount,
});
} catch (error) {
result.push({ id: n.id, error });
}
result.push(...(await fetchRecursive(base_url, ch_arr)));
} else {
result.push(n);
}
}
return result;
}
{id: 13661, externalId: "КЗ000000000000002853", text: "J-Y (ST) Y", children: false, productCount: 3}
D4
S
S