Hello!
I got everything down to make a login using laravel, vue and axios.
The only issue at the moment i have is with axios, i don’t know if i am at the right place, if i’m not, i’m sorry. Anyway
Everytime when i ‘login’ axios returns me these errors:
"
Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set ‘always_populate_raw_post_data’ to ‘-1’ in php.ini and use the php://input stream instead. in Unknown on line 0
Warning: Cannot modify header information - headers already sent in Unknown on line 0
{“token”:"**"}"
The token is what i need, but i cant get to it… because of the warning
This is the post code im using to get this result
<script>
export default {
data(){
return{
loginDet:{
email: "",
password: ""
}
}
},
methods:{
login(){
var token = document.head.querySelector('meta[name="csrf-token"]');
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
axios.post('/login', this.loginDet)
.then((res) => {
console.log(res);
let token = res.data.token;
console.log(token);
localStorage.setItem('token', token);
this.$router.push('/home');
})
.catch((err) => console.error(err));
}
}
}
</script>
Am i missing headers? …
I hope that someone can help me here, because its pretty much bugging me for 2 days
Thank you so much!