# [Vue.js] Axios then function also does catch? Subscribe to RSS

My post is successful, but I can’t do anything in the then statement except console.log(); it always jumps to the catch.

axios.post(‘/group/15/discussion/‘+ this.discussion.id+ ‘/schedule’,this.form, {handleErrors:true})
.then(function(response) {
//this.form.valid = true;
console.log(“success”);

console.log(‘set form valid’);
this.$refs[‘schedule-group-discussion-‘+this.id].hide(); console.log(‘close modal’); /*this.$emit(‘updateDiscussion’,response.data.discussion);
this.\$toast.success(response.data.message,’Success!’,{icon: ‘fas fa-check-circle’});*/
})
.catch((error) => {
console.log(“catch”);
this.form.valid = false;
});

success
set form valid
catch

What is wrong?

### Solution :

The problem is the scope of this. You’re actually getting an error, cannot read property valid of undefined, but you didn’t console.log(error). You need to use the fat arrow function in the .then() as well:

.then(function(response) {

to

.then((response) => {

Now this is scoped correctly.