I\'m using:
And after trying to login to my page when using
You face this error when the API url and client url aren't the same. Vue CLI 3 (and in the core of it, Webpack) allows you to proxy your API url to your client url.
Inside vue.config.js file add following lines:
// vue.config.js
module.exports = {
// options...
devServer: {
proxy: 'https://mywebsite/',
}
}
And then send your ajax calls to http://localhost/api/.
You can read the full article here: How to deal with CORS error on Vue CLI 3?