Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

238
Views
How to post Axios data has array inside?

I want to post files to groups. by storing the group id I want to send files to groupsFinal, but axios.post() will only post to the first array of groupsFinal, I tried for loop but it fails axios post.

let groups = [{id:"a001", groupName:"Group101"},{id:"a002", groupName:"Group202"}]
let groupsFinal = [];
  for (let a = 0; a < groups.length; a++) {
    let d = JSON.parse(JSON.stringify(groups[a]));
    d.img = null;
    groupsFinal.push(d);
  }
  let p = {
    fileId: "file_001",
    groups: groupsFinal, // array[]
  };
return new Promise((resolve, reject) => {
    axios
      .post("/shareFileToGroup", p, {
        headers: {
          "Content-Type": "application/json"
        },
      })
      .then(function (response) {
        resolve("success");
      })
      .catch(function (error) {
        reject("error");
      })
      .finally(function () {
        // always executed
      });
  });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!