mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
feat(webapp): categorize the cashflow uncategorized transactions
This commit is contained in:
@@ -104,8 +104,8 @@ export function useDeleteCashflowTransaction(props) {
|
||||
export function useAccountTransactionsInfinity(
|
||||
accountId,
|
||||
query,
|
||||
axios,
|
||||
infinityProps,
|
||||
axios,
|
||||
) {
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
@@ -134,6 +134,45 @@ export function useAccountTransactionsInfinity(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve account transactions infinity scrolling.
|
||||
* @param {number} accountId
|
||||
* @param {*} axios
|
||||
* @returns
|
||||
*/
|
||||
export function useAccountUncategorizedTransactionsInfinity(
|
||||
accountId,
|
||||
query,
|
||||
infinityProps,
|
||||
axios,
|
||||
) {
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useInfiniteQuery(
|
||||
[t.CASHFLOW_ACCOUNT_UNCATEGORIZED_TRANSACTIONS_INFINITY, accountId],
|
||||
async ({ pageParam = 1 }) => {
|
||||
const response = await apiRequest.http({
|
||||
...axios,
|
||||
method: 'get',
|
||||
url: `/api/cashflow/transactions/${accountId}/uncategorized`,
|
||||
params: { page: pageParam, ...query },
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
{
|
||||
getPreviousPageParam: (firstPage) => firstPage.pagination.page - 1,
|
||||
getNextPageParam: (lastPage) => {
|
||||
const { pagination } = lastPage;
|
||||
|
||||
return pagination.total > pagination.page_size * pagination.page
|
||||
? lastPage.pagination.page + 1
|
||||
: undefined;
|
||||
},
|
||||
...infinityProps,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh cashflow transactions infinity.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user