I'm having an issue with the axios (function?) with vue and Laravel. I have this running with a simple alert('something') - not using axios, just the alert in the function) but I'm getting these errors when running the current code
POST http://127.0.0.1:8000/follow/2 500 (Internal Server Error)
dispatchXhrRequest @ xhr.js?b50d:178
xhrAdapter @ xhr.js?b50d:12
dispatchRequest @ dispatchRequest.js?5270:52
Promise.then (async)
request @ Axios.js?0a06:61
Axios.<computed> @ Axios.js?0a06:86
wrap @ bind.js?1d2b:9
followUser @ FollowButton.vue?618e:17
invokeWithErrorHandling @ vue.common.dev.js?4650:1859
invoker @ vue.common.dev.js?4650:2184
original._wrapper @ vue.common.dev.js?4650:7543
My code
methods: {
followUser() {
axios.post('/follow/' + this.userId)
.then(response => {
alert(response.data);
});
}
}
I'm following this tutorial https://www.youtube.com/watch?v=ImtZ5yENzgE at 3:28:10 and I can't see where I've gone wrong for the life of me. Any help much appreciated.
question from:
https://stackoverflow.com/questions/65836755/how-do-i-resolve-500-error-using-vue-click-with-axios 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…