Can you give me your thoughts on how to post an array with some object?
This is the code I am working with:
const selectedJobs = this.ms.selectedItems;
if (!selectedJobs) {
return;
}
const selectedJobsId = selectedJobs.map((jobsId) =>
jobsId.id
);
In this scenario, I retrieve all job IDs as an array ['618e2ee9', '3ee199b7']
const payload = [
{
jobId: selectedJobsId,
state: 2,
}
];
The payload gives me an array containing one object that includes an array of job IDs and a state. As shown below
[
{
"jobId": [
"618e2ee9",
"3ee199b7"
],
"state": 2
}
]
I need the response to be one array with separate objects for each job ID:
[
{
"jobId": "618e2ee9",
"state": 2
},
{
"jobId": "3ee199b7",
"state": 2
}
]
If you have any ideas, please share them!