Answers for "axios send array data"

15

axios send post data

// Send a POST request
axios({
  method: 'post',
  url: '/user/12345',
  data: {
    firstName: 'Fred',
    lastName: 'Flintstone'
  },
  headers: {'Authorization': 'Bearer ...'}
});
Posted by: Guest on April-13-2020
0

axios get array of urls

let linksArr = ['https://jsonplaceholder.typicode.com/posts', 'https://jsonplaceholder.typicode.com/comments'];

axios.all(linksArr.map(l => axios.get(l)))
  .then(axios.spread(function (...res) {
    // all requests are now complete
    console.log(res);
  }));
Posted by: Guest on February-05-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language