'Loop data on request multipart field
Im using request multipart field on JS, but why my input data its giving some loop like this :
{ name_speaker: 'oklee' }
{ name_speaker: 'oklee', topic: 'yes' }
{ name_speaker: 'oklee', topic: 'yes', study_program: 'test' }
{
name_speaker: 'oklee',
topic: 'yes',
study_program: 'test',
schedule: '2022-01-05'
}
I just want get last result :
{
name_speaker: 'oklee',
topic: 'yes',
study_program: 'test',
schedule: '2022-01-05'
}
This is my code for get that :
async submitData({response, request}) {
var body = {}
request.multipart.field((name, value) => {
body[name] = value
console.log(body)
}).process()
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|