So I am appending additional data to FormData
:
async submit(el, codes = null) {
try {
const formData = new FormData(el);
if (codes) {
for (let i = 0; i < codes.length; i++) {
formData.append('codes[]', codes[i]);
}
}
const response = await http({
method: el.method,
url: el.action,
data: formData,
});
}
}
But this is what I get:
[2021-09-01 08:56:57] local.INFO: array (
'email' => 'email@gmail.com',
'password' => 'password',
'codes' =>
array (
0 => '[object Object]',
),
)
And how it should be:
[2021-09-01 09:00:18] local.INFO: array (
'email' => 'email@gmail.com',
'password' => 'password',
'codes' =>
array (
0 =>
array (
'code' => 'test2',
'puk' => 'DH58LEJV',
),
),
)
How should I fix this?