I am trying to consume my api using ajax (axios) request as the way it is instructed in laravel docs here. But it is not working, shows errors like the following image
My sample header response looks likes the following:
My ajax request looks like this:
axios.get('http://localhost:81/test_laravel/public/api/user')
.then(function(response){
console.log('Component mounted.')
})
.catch(function(error){
console.log(error.response.status)
});
Don't have a clue what is going on. Please help.