0👍
I think you should define home url in the blade page you use vue app like this.
<script>
window.home = "<?php echo your-host-url ?>";
</script>
To make sure the API route is correct you add:
axios.get(window.home + '/api/user').then(response => {
this.userInfo = response.data
})
-1👍
The solution is adding this to .htaccess of root folder (not only inside the public folder)
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
- [Vuejs]-How to render WordPress rest api datawith vue.js
- [Vuejs]-Radiobutton-like behaving Vue.js components
Source:stackexchange.com