3👍
✅
Try in the following way.
editTool() {
return ToolService.editTool(this.id, this.editedItem)
},
newTool() {
return ToolService.addTool(this.editedItem)
},
newMethod() {
let method = this.newTool;
if (this.edit) method = this.editTool;
return method().then((response) => {
this.$refs.dialogInfo.setSuccess(response);
})
.catch((error) => {
this.$refs.dialogInfo.setError(error);
})
.finally(() => {
this.$emit("completed");
});
}
Source:stackexchange.com