mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 23:47:33 +08:00
code refactor
This commit is contained in:
@@ -67,6 +67,7 @@ import { useTransactionCategoriesStore } from '@/stores/transactionCategory.ts';
|
||||
import type { PartialRecord } from '@/core/base.ts';
|
||||
import { type LocalizedPresetCategory, CategoryType } from '@/core/category.ts';
|
||||
import { categorizedArrayToPlainArray } from '@/lib/common.ts';
|
||||
import { localizedPresetCategoriesToTransactionCategoryCreateWithSubCategories } from '@/lib/category.ts';
|
||||
|
||||
type SnackBarType = InstanceType<typeof SnackBar>;
|
||||
|
||||
@@ -113,7 +114,8 @@ function getCategoryTypeName(categoryType: CategoryType): string {
|
||||
function save(): void {
|
||||
submitting.value = true;
|
||||
|
||||
const submitCategories = categorizedArrayToPlainArray(allPresetCategories.value);
|
||||
const presetCategoriesArray = categorizedArrayToPlainArray(allPresetCategories.value);
|
||||
const submitCategories = localizedPresetCategoriesToTransactionCategoryCreateWithSubCategories(presetCategoriesArray);
|
||||
|
||||
transactionCategoriesStore.addCategories({
|
||||
categories: submitCategories
|
||||
|
||||
@@ -68,6 +68,7 @@ import type { PartialRecord } from '@/core/base.ts';
|
||||
import type { LanguageOption } from '@/locales/index.ts';
|
||||
import { type LocalizedPresetCategory, CategoryType } from '@/core/category.ts';
|
||||
import { getObjectOwnFieldCount, categorizedArrayToPlainArray } from '@/lib/common.ts';
|
||||
import { localizedPresetCategoriesToTransactionCategoryCreateWithSubCategories } from '@/lib/category.ts';
|
||||
|
||||
const props = defineProps<{
|
||||
f7route: Router.Route;
|
||||
@@ -109,7 +110,8 @@ function save(): void {
|
||||
submitting.value = true;
|
||||
showLoading(() => submitting.value);
|
||||
|
||||
const submitCategories = categorizedArrayToPlainArray(allPresetCategories.value);
|
||||
const presetCategoriesArray = categorizedArrayToPlainArray(allPresetCategories.value);
|
||||
const submitCategories = localizedPresetCategoriesToTransactionCategoryCreateWithSubCategories(presetCategoriesArray);
|
||||
|
||||
transactionCategoriesStore.addCategories({
|
||||
categories: submitCategories
|
||||
|
||||
Reference in New Issue
Block a user