[Vuejs]-Response to preflight request doesn't pass access control No 'Access-Control-Allow-Origin'

0👍

Below code helped me you can try this format:

created() {
  // POST request using axios with set headers
  const article = { title: "Vue POST Request Example" };
  const headers = { 
     'X-API-Key': 'randomKey123123'
  };
  axios.post(url, article, { headers })
    .then(response => console.log(response.data)
   );
}

Leave a comment