code refactor

This commit is contained in:
MaysWind
2023-08-13 20:06:42 +08:00
parent 41a8b8007a
commit 8bed529d05
3 changed files with 25 additions and 37 deletions
@@ -209,22 +209,9 @@ export default {
self.submitting = true;
const submitCategory = {
type: self.category.type,
name: self.category.name,
parentId: self.category.parentId,
icon: self.category.icon,
color: self.category.color,
comment: self.category.comment
};
if (self.editCategoryId) {
submitCategory.id = self.category.id;
submitCategory.hidden = !self.category.visible;
}
self.transactionCategoriesStore.saveCategory({
category: submitCategory
category: self.category,
isEdit: !!self.editCategoryId
}).then(() => {
self.submitting = false;
+2 -15
View File
@@ -252,22 +252,9 @@ export default {
self.submitting = true;
self.$showLoading(() => self.submitting);
const submitCategory = {
type: self.category.type,
name: self.category.name,
parentId: self.category.parentId,
icon: self.category.icon,
color: self.category.color,
comment: self.category.comment
};
if (self.editCategoryId) {
submitCategory.id = self.category.id;
submitCategory.hidden = !self.category.visible;
}
self.transactionCategoriesStore.saveCategory({
category: submitCategory
category: self.category,
isEdit: !!self.editCategoryId
}).then(() => {
self.submitting = false;
self.$hideLoading();