Use normal return on error also for applinksModel
This commit is contained in:
@@ -121,13 +121,13 @@ export default {
|
||||
data.icon = this.icon.data.replace(/^data:image\/[a-z]+;base64,/, '');
|
||||
}
|
||||
|
||||
try {
|
||||
if (this.mode === 'edit') await applinksModel.update(this.id, data);
|
||||
else await applinksModel.add(data);
|
||||
} catch (e) {
|
||||
console.error('Failed to edit or add applink', e);
|
||||
let error;
|
||||
if (this.mode === 'edit') [error] = await applinksModel.update(this.id, data);
|
||||
else [error] = await applinksModel.add(data);
|
||||
|
||||
if (error) {
|
||||
this.busy = false;
|
||||
return;
|
||||
return console.error(error);
|
||||
}
|
||||
|
||||
this.busy = false;
|
||||
@@ -145,10 +145,11 @@ export default {
|
||||
|
||||
if (!yes) return;
|
||||
|
||||
// TODO
|
||||
console.log('remove', this.id)
|
||||
// await volumesModel.remove(volume.id);
|
||||
// await this.refresh();
|
||||
const [error] = await applinksModel.remove(this.id);
|
||||
if (error) return console.error(error);
|
||||
|
||||
this.$emit('success');
|
||||
this.$refs.applinkDialog.close();
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -161,8 +162,8 @@ export default {
|
||||
:alternate-label="mode === 'edit' ? 'Delete' : ''"
|
||||
alternate-style="danger"
|
||||
:reject-label="$t('main.dialog.cancel')"
|
||||
reject-style="secondary"
|
||||
:confirm-label="$t('main.dialog.save')"
|
||||
confirm-style="success"
|
||||
:confirm-active="isValid"
|
||||
:confirm-busy="busy"
|
||||
@confirm="onSubmit()"
|
||||
|
||||
Reference in New Issue
Block a user