Remove catch blocks where possible

This commit is contained in:
Bubka
2020-01-27 14:55:30 +01:00
parent 59fe66710a
commit a1f5358e4a
3 changed files with 32 additions and 63 deletions

View File

@ -128,15 +128,11 @@
this.deleteIcon()
}
this.form.put('/api/twofaccounts/' + this.$route.params.twofaccountId)
.then(response => {
this.$router.push({name: 'accounts', params: { InitialEditMode: true }});
})
.catch(error => {
if( error.response.status !== 422 ) {
this.$router.push({ name: 'genericError', params: { err: error.response } });
}
});
await this.form.put('/api/twofaccounts/' + this.$route.params.twofaccountId)
if( this.form.errors.any() === false ) {
this.$router.push({name: 'accounts', params: { InitialEditMode: true }})
}
},
@ -147,7 +143,7 @@
this.$router.push({name: 'accounts', params: { InitialEditMode: true }});
},
uploadIcon(event) {
async uploadIcon(event) {
// clean possible tempIcon but keep original one
this.deleteIcon()
@ -155,15 +151,9 @@
let imgdata = new FormData();
imgdata.append('icon', this.$refs.iconInput.files[0]);
this.form.upload('/api/icon/upload', imgdata)
.then(response => {
this.tempIcon = response.data;
})
.catch(error => {
if( error.response.status !== 422 ) {
this.$router.push({ name: 'genericError', params: { err: error.response } });
}
});
const { data } = await this.form.upload('/api/icon/upload', imgdata)
this.tempIcon = data;
},