From f2c043a299fb396dfb744c353c0a675cb19c5d9c Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 9 Feb 2025 15:58:55 +0800 Subject: [PATCH] code refactor --- src/views/mobile/HomePage.vue | 4 ++-- src/views/mobile/accounts/ListPage.vue | 4 ++-- src/views/mobile/categories/ListPage.vue | 4 ++-- src/views/mobile/tags/ListPage.vue | 4 ++-- src/views/mobile/templates/ListPage.vue | 4 ++-- src/views/mobile/transactions/ListPage.vue | 26 +++++++++++----------- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/views/mobile/HomePage.vue b/src/views/mobile/HomePage.vue index 170b56f9..df74b6b9 100644 --- a/src/views/mobile/HomePage.vue +++ b/src/views/mobile/HomePage.vue @@ -267,7 +267,7 @@ function init(): void { } } -function reload(done: (() => void) | null): void { +function reload(done?: () => void): void { const force = !!done; overviewStore.loadTransactionOverview({ @@ -289,7 +289,7 @@ function reload(done: (() => void) | null): void { function onPageAfterIn(): void { if (!loading.value) { - reload(null); + reload(); } } diff --git a/src/views/mobile/accounts/ListPage.vue b/src/views/mobile/accounts/ListPage.vue index 57234e55..98e8a922 100644 --- a/src/views/mobile/accounts/ListPage.vue +++ b/src/views/mobile/accounts/ListPage.vue @@ -275,7 +275,7 @@ function init(): void { }); } -function reload(done: (() => void) | null): void { +function reload(done?: () => void): void { if (sortable.value) { done?.(); return; @@ -418,7 +418,7 @@ function onSort(event: { el: { id: string }; from: number; to: number }): void { function onPageAfterIn(): void { if (accountsStore.accountListStateInvalid && !loading.value) { - reload(null); + reload(); } routeBackOnError(props.f7router, loadingError); diff --git a/src/views/mobile/categories/ListPage.vue b/src/views/mobile/categories/ListPage.vue index 96b6d7d9..565a84c9 100644 --- a/src/views/mobile/categories/ListPage.vue +++ b/src/views/mobile/categories/ListPage.vue @@ -229,7 +229,7 @@ function init(): void { }); } -function reload(done: (() => void) | null): void { +function reload(done?: () => void): void { if (sortable.value) { done?.(); return; @@ -373,7 +373,7 @@ function onSort(event: { el: { id: string }; from: number; to: number }): void { function onPageAfterIn(): void { if (transactionCategoriesStore.transactionCategoryListStateInvalid && !loading.value) { - reload(null); + reload(); } routeBackOnError(props.f7router, loadingError); diff --git a/src/views/mobile/tags/ListPage.vue b/src/views/mobile/tags/ListPage.vue index 53b01d2b..c6033801 100644 --- a/src/views/mobile/tags/ListPage.vue +++ b/src/views/mobile/tags/ListPage.vue @@ -224,7 +224,7 @@ function init(): void { }); } -function reload(done: (() => void) | null): void { +function reload(done?: () => void): void { if (sortable.value || hasEditingTag.value) { done?.(); return; @@ -402,7 +402,7 @@ function onSort(event: { el: { id: string }, from: number, to: number }): void { function onPageAfterIn(): void { if (transactionTagsStore.transactionTagListStateInvalid && !loading.value) { - reload(null); + reload(); } routeBackOnError(props.f7router, loadingError); diff --git a/src/views/mobile/templates/ListPage.vue b/src/views/mobile/templates/ListPage.vue index f5b52430..5fc2e048 100644 --- a/src/views/mobile/templates/ListPage.vue +++ b/src/views/mobile/templates/ListPage.vue @@ -165,7 +165,7 @@ function init(): void { }); } -function reload(done: (() => void) | null): void { +function reload(done?: () => void): void { if (sortable.value) { done?.(); return; @@ -310,7 +310,7 @@ function onSort(event: { el: { id: string }; from: number; to: number }): void { function onPageAfterIn(): void { if ((!isDefined(transactionTemplatesStore.transactionTemplateListStatesInvalid[templateType.value]) || transactionTemplatesStore.transactionTemplateListStatesInvalid[templateType.value]) && !loading.value) { - reload(null); + reload(); } routeBackOnError(props.f7router, loadingError); diff --git a/src/views/mobile/transactions/ListPage.vue b/src/views/mobile/transactions/ListPage.vue index 9f3161d8..d1300964 100644 --- a/src/views/mobile/transactions/ListPage.vue +++ b/src/views/mobile/transactions/ListPage.vue @@ -700,10 +700,10 @@ function init(): void { tagFilterType: initQuery['tagFilterType'] && parseInt(initQuery['tagFilterType']) >= 0 ? parseInt(initQuery['tagFilterType']) : undefined }); - reload(null); + reload(); } -function reload(done: (() => void) | null): void { +function reload(done?: () => void): void { const force = !!done; if (!done) { @@ -809,7 +809,7 @@ function changeDateFilter(dateType: number): void { showDatePopover.value = false; if (changed) { - reload(null); + reload(); } } @@ -833,7 +833,7 @@ function changeCustomDateFilter(minTime: number, maxTime: number): void { showCustomDateRangeSheet.value = false; if (changed) { - reload(null); + reload(); } } @@ -859,7 +859,7 @@ function shiftDateRange(minTime: number, maxTime: number, scale: number): void { }); if (changed) { - reload(null); + reload(); } } @@ -898,7 +898,7 @@ function changeTypeFilter(type: number): void { showMorePopover.value = false; if (changed) { - reload(null); + reload(); } } @@ -914,7 +914,7 @@ function changeCategoryFilter(categoryIds: string): void { showCategoryPopover.value = false; if (changed) { - reload(null); + reload(); } } @@ -940,7 +940,7 @@ function changeAccountFilter(accountIds: string): void { showAccountPopover.value = false; if (changed) { - reload(null); + reload(); } } @@ -960,7 +960,7 @@ function changeTagFilter(tagIds: string): void { showMorePopover.value = false; if (changed) { - reload(null); + reload(); } } @@ -980,7 +980,7 @@ function changeTagFilterType(filterType: number): void { showMorePopover.value = false; if (changed) { - reload(null); + reload(); } } @@ -994,7 +994,7 @@ function changeKeywordFilter(keyword: string): void { }); if (changed) { - reload(null); + reload(); } } @@ -1016,7 +1016,7 @@ function changeAmountFilter(filterType: string): void { showMorePopover.value = false; if (changed) { - reload(null); + reload(); } } @@ -1074,7 +1074,7 @@ function onPopoverOpen(event: { $el: Framework7Dom }): void { function onPageAfterIn(): void { if (transactionsStore.transactionListStateInvalid && !loading.value) { - reload(null); + reload(); } routeBackOnError(props.f7router, loadingError);