Use async/await

This commit is contained in:
Bubka
2020-01-16 22:21:05 +01:00
parent 7e53eea7f2
commit 01862e11a3
4 changed files with 101 additions and 112 deletions

View File

@ -62,21 +62,22 @@
},
methods : {
handleSubmit(e) {
async handleSubmit(e) {
e.preventDefault()
this.validationErrors = {}
axios.post('/api/password/reset', {
email: this.email,
password: this.password,
password_confirmation : this.password_confirmation,
token: this.token
})
.then(response => {
try {
const { data } = await axios.post('/api/password/reset', {
email: this.email,
password: this.password,
password_confirmation : this.password_confirmation,
token: this.token
})
this.$router.go('/');
})
.catch(error => {
}
catch (error) {
if( error.response.data.errors ) {
this.validationErrors = error.response.data.errors
}
@ -86,7 +87,7 @@
else {
this.$router.push({ name: 'genericError', params: { err: error.response.data.message } });
}
});
}
}
},
}