fix: bulk uncategorize transactions - fix API endpoint and error handling
This commit is contained in:
+7
-2
@@ -35,11 +35,16 @@ function UncategorizeBankTransactionsBulkAlert({
|
||||
uncategorizeTransactions({ ids: uncategorizeTransactionsIds })
|
||||
.then(() => {
|
||||
AppToaster.show({
|
||||
message: 'The bank feeds of the bank account has been resumed.',
|
||||
message: 'The selected transactions have been uncategorized.',
|
||||
intent: Intent.SUCCESS,
|
||||
});
|
||||
})
|
||||
.catch((error) => {})
|
||||
.catch((error) => {
|
||||
AppToaster.show({
|
||||
message: 'Something went wrong while uncategorizing transactions.',
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
closeAlert(name);
|
||||
});
|
||||
|
||||
@@ -36,10 +36,16 @@ export function useUncategorizeTransactionsBulkAction(
|
||||
Error,
|
||||
UncategorizeTransactionsBulkValues
|
||||
>(
|
||||
(value) =>
|
||||
apiRequest.post(`/cashflow/transactions/uncategorize/bulk`, {
|
||||
ids: value.ids,
|
||||
}),
|
||||
(value) => {
|
||||
// Build query string with multiple uncategorizedTransactionIds parameters
|
||||
const params = new URLSearchParams();
|
||||
value.ids.forEach((id) =>
|
||||
params.append('uncategorizedTransactionIds', String(id)),
|
||||
);
|
||||
return apiRequest.delete(
|
||||
`/banking/categorize/bulk?${params.toString()}`,
|
||||
);
|
||||
},
|
||||
{
|
||||
onSuccess: (res, values) => {
|
||||
// Invalidate the account uncategorized transactions.
|
||||
|
||||
Reference in New Issue
Block a user