mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 09:14:27 +08:00
support using duplicate checker to prevent duplicate submissions for new transaction record
This commit is contained in:
@@ -736,7 +736,7 @@ export const useAccountsStore = defineStore('accounts', {
|
||||
});
|
||||
});
|
||||
},
|
||||
saveAccount({ account, subAccounts, isEdit }) {
|
||||
saveAccount({ account, subAccounts, isEdit, clientSessionId }) {
|
||||
const self = this;
|
||||
|
||||
const submitSubAccounts = [];
|
||||
@@ -776,6 +776,10 @@ export const useAccountsStore = defineStore('accounts', {
|
||||
subAccounts: account.type === accountConstants.allAccountTypes.SingleAccount ? null : submitSubAccounts,
|
||||
};
|
||||
|
||||
if (clientSessionId) {
|
||||
submitAccount.clientSessionId = clientSessionId;
|
||||
}
|
||||
|
||||
if (isEdit) {
|
||||
submitAccount.id = account.id;
|
||||
submitAccount.hidden = !account.visible;
|
||||
|
||||
@@ -745,7 +745,7 @@ export const useTransactionsStore = defineStore('transactions', {
|
||||
});
|
||||
});
|
||||
},
|
||||
saveTransaction({ transaction, defaultCurrency, isEdit }) {
|
||||
saveTransaction({ transaction, defaultCurrency, isEdit, clientSessionId }) {
|
||||
const self = this;
|
||||
const settingsStore = useSettingsStore();
|
||||
const exchangeRatesStore = useExchangeRatesStore();
|
||||
@@ -764,6 +764,10 @@ export const useTransactionsStore = defineStore('transactions', {
|
||||
utcOffset: transaction.utcOffset
|
||||
};
|
||||
|
||||
if (clientSessionId) {
|
||||
submitTransaction.clientSessionId = clientSessionId;
|
||||
}
|
||||
|
||||
if (transaction.type === transactionConstants.allTransactionTypes.Expense) {
|
||||
submitTransaction.categoryId = transaction.expenseCategory;
|
||||
} else if (transaction.type === transactionConstants.allTransactionTypes.Income) {
|
||||
|
||||
@@ -257,7 +257,7 @@ export const useTransactionCategoriesStore = defineStore('transactionCategories'
|
||||
});
|
||||
});
|
||||
},
|
||||
saveCategory({ category, isEdit }) {
|
||||
saveCategory({ category, isEdit, clientSessionId }) {
|
||||
const self = this;
|
||||
|
||||
const submitCategory = {
|
||||
@@ -269,6 +269,10 @@ export const useTransactionCategoriesStore = defineStore('transactionCategories'
|
||||
comment: category.comment
|
||||
};
|
||||
|
||||
if (clientSessionId) {
|
||||
submitCategory.clientSessionId = clientSessionId;
|
||||
}
|
||||
|
||||
if (isEdit) {
|
||||
submitCategory.id = category.id;
|
||||
submitCategory.hidden = !category.visible;
|
||||
|
||||
Reference in New Issue
Block a user