Use and handle default Laravel validation errors response

This commit is contained in:
Bubka
2020-01-19 23:02:20 +01:00
parent 8940efc225
commit 2be4e3e4e1
10 changed files with 29 additions and 57 deletions

View File

@ -115,8 +115,8 @@
this.$router.push({name: 'accounts', params: { InitialEditMode: false }});
})
.catch(error => {
if( error.response.data.validation ) {
this.validationErrors = error.response.data.validation
if( error.response.status == 422 ) {
this.validationErrors = error.response.data.errors
}
else {
this.$router.push({ name: 'genericError', params: { err: error.response.data.message } });
@ -152,8 +152,8 @@
this.validationErrors['qrcode'] = '';
})
.catch(error => {
if( error.response.data.validation ) {
this.validationErrors = error.response.data.validation
if( error.response.status == 422 ) {
this.validationErrors = error.response.data.errors
}
else {
this.$router.push({ name: 'genericError', params: { err: error.response.data.message } });
@ -185,8 +185,8 @@
this.validationErrors['icon'] = '';
})
.catch(error => {
if( error.response.data.validation ) {
this.validationErrors = error.response.data.validation
if( error.response.status == 422 ) {
this.validationErrors = error.response.data.errors
}
else {
this.$router.push({ name: 'genericError', params: { err: error.response.data.message } });