What I want is to insert a field index into my array
My code thar I receive my arrays is like that:
const onFinish = (values) => {
console.log(values.fields);
addFields({ formName: 'TABLE NAME', fields: values.fields }).then(() => {
//API CALL WHICH RETURNS A RESPONSE
});
};
values.fields
is the array that I want to make it work
values.field array :
[
{
"field": "Peso do bezerro (kg)",
"fieldtype": "Numeric"
},
{
"field": "test",
"fieldtype": "Text"
},
{
"field": "Obs",
"fieldtype": "Text"
}
]
This array can have ‘x’ objects,What I want is for each add a field named index(which will get if it's the first and add 0 if the second will add a 1 and following...
).Someone knows how to make it work ?