Answers for "axios query array on get"

0

pass query string in axios instance

pass it as params in axios instance

const axiosInstance = axios.create({

  baseURL: baseURL,
  timeout: 5000,
  params: {
    api_key : "xyz"
  },


  
});
Posted by: Guest on September-28-2021
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