do not update the list if no delete action is performed

This commit is contained in:
MaysWind
2026-04-26 01:08:27 +08:00
parent 1e38d1b18b
commit 1d5102a015
2 changed files with 8 additions and 6 deletions
@@ -57,14 +57,16 @@ const showState = ref<boolean>(false);
const deleting = ref<boolean>(false);
const deleteIds = ref<string[]>([]);
const currentPassword = ref<string>('');
const tryDeleted = ref<boolean>(false);
let resolveFunc: ((response: number) => void) | null = null;
let rejectFunc: ((reason?: unknown) => void) | null = null;
let rejectFunc: ((tryDeleted: boolean) => void) | null = null;
function open(options: { updateIds: string[] }): Promise<number> {
deleteIds.value = options.updateIds;
currentPassword.value = '';
deleting.value = false;
tryDeleted.value = false;
showState.value = true;
return new Promise((resolve, reject) => {
@@ -75,6 +77,7 @@ function open(options: { updateIds: string[] }): Promise<number> {
function confirm(): void {
deleting.value = true;
tryDeleted.value = true;
transactionsStore.batchDeleteTransactions({
transactionIds: deleteIds.value,
@@ -93,7 +96,7 @@ function confirm(): void {
}
function cancel(): void {
rejectFunc?.();
rejectFunc?.(tryDeleted.value);
showState.value = false;
}
@@ -412,11 +412,10 @@ function batchDeleteTransactions(): void {
}
selectedTransactions.value = {};
emit('update:transactions');
}).catch(error => {
if (error) {
snackbar.value?.showError(error);
}).catch(tryDeleted => {
if (tryDeleted) {
emit('update:transactions');
}
emit('update:transactions');
});
}