This is how I get the data:
const dataSaved = [{
count: 52,
deliveryAmount: 0,
discountAmount: 7,
guests: 2,
refundedAmount: 9,
serviceChargeAmount: 4,
storeId: "aslkasad",
subtotal: 2,
taxAmount: 4,
total: 3
}, {
count: 52,
deliveryAmount: 0,
discountAmount: 7,
guests: 2,
refundedAmount: 9,
serviceChargeAmount: 4,
storeId: "ldfgfgdf",
subtotal: 2,
taxAmount: 4,
total: 3
}]
So basically I have made a method in which I'm filtering an array of objects and just taking out the fields I need:
getDataParsed(dataSaved, storeFieldRequired) {
const barData = [];
for (const store of dataSaved) {
barData.push({
data: [store.storeFieldRequired],
label: store.storeId
});
}
return barData;
}
When I want to get an specific field of the array, my [store.storeFieldRequired] brings undefined. How can I solve it?