I'm currently utilizing Vue Js in my Laravel project to execute a POST request. Everything seems to be functioning properly, but I'm encountering some issues while dealing with the promise:
axios.post('/customer/update',this.customer)
.then(response =>(
//this.customer = response.data.customer
this.error.text = response.data.message
)).then(response =>(
this.error.show = true
)).then(response =>(
this.error.class = true
)).catch(err => {
console.log(err);
})
}
Currently, I am forced to string multiple .then() statements together to handle each individual statement within it. My ideal scenario would be something like this:
axios.post('/customer/update',this.customer)
.then(response =>(
this.customer = response.data.customer
this.error.text = response.data.message
this.error.show = true
this.error.class = true
)).catch(err => {
console.log(err);
})
}
If you have any insights or suggestions, please feel free to share because I can't seem to identify what's causing the issue here. It should work as intended, but it's not.
The error message I'm receiving is:
Uncaught SyntaxError: Unexpected token 'this'
This error is pointing towards my created tag:
created(){
this.greeting;
console.log(this.customer)
}