Merge branch 'develop' into bulk-categorize-bank-transactions

This commit is contained in:
Ahmed Bouhuolia
2024-08-04 22:23:02 +02:00
committed by GitHub
29 changed files with 777 additions and 74 deletions

View File

@@ -9,7 +9,7 @@ export function useUploadAttachments(props) {
const apiRequest = useApiRequest();
return useMutation(
(values) => apiRequest.post('/attachments', values),
(values) => apiRequest.post('attachments', values),
props,
);
}
@@ -21,7 +21,7 @@ export function useDeleteAttachment(props) {
const apiRequest = useApiRequest();
return useMutation(
(key: string) => apiRequest.delete(`/attachments/${key}`),
(key: string) => apiRequest.delete(`attachments/${key}`),
props,
);
}
@@ -35,7 +35,7 @@ export function useGetPresignedUrlAttachment(props) {
return useMutation(
(key: string) =>
apiRequest
.get(`/attachments/${key}/presigned-url`)
.get(`attachments/${key}/presigned-url`)
.then((res) => res.data),
props,
);

View File

@@ -0,0 +1,91 @@
// @ts-nocheck
import {
UseMutationOptions,
UseMutationResult,
useQueryClient,
useMutation,
} from 'react-query';
import useApiRequest from '../useRequest';
import t from './types';
type PuaseFeedsBankAccountValues = { bankAccountId: number };
interface PuaseFeedsBankAccountResponse {}
/**
* Resumes the feeds syncing of the bank account.
* @param {UseMutationResult<PuaseFeedsBankAccountResponse, Error, ExcludeBankTransactionValue>} options
* @returns {UseMutationResult<PuaseFeedsBankAccountResponse, Error, ExcludeBankTransactionValue>}
*/
export function usePauseFeedsBankAccount(
options?: UseMutationOptions<
PuaseFeedsBankAccountResponse,
Error,
PuaseFeedsBankAccountValues
>,
): UseMutationResult<
PuaseFeedsBankAccountResponse,
Error,
PuaseFeedsBankAccountValues
> {
const queryClient = useQueryClient();
const apiRequest = useApiRequest();
return useMutation<
PuaseFeedsBankAccountResponse,
Error,
PuaseFeedsBankAccountValues
>(
(values) =>
apiRequest.post(
`/banking/bank_accounts/${values.bankAccountId}/pause_feeds`,
),
{
onSuccess: (res, values) => {
queryClient.invalidateQueries([t.ACCOUNT, values.bankAccountId]);
},
...options,
},
);
}
type ResumeFeedsBankAccountValues = { bankAccountId: number };
interface ResumeFeedsBankAccountResponse {}
/**
* Resumes the feeds syncing of the bank account.
* @param {UseMutationResult<ResumeFeedsBankAccountResponse, Error, ResumeFeedsBankAccountValues>} options
* @returns {UseMutationResult<ResumeFeedsBankAccountResponse, Error, ResumeFeedsBankAccountValues>}
*/
export function useResumeFeedsBankAccount(
options?: UseMutationOptions<
ResumeFeedsBankAccountResponse,
Error,
ResumeFeedsBankAccountValues
>,
): UseMutationResult<
ResumeFeedsBankAccountResponse,
Error,
ResumeFeedsBankAccountValues
> {
const queryClient = useQueryClient();
const apiRequest = useApiRequest();
return useMutation<
ResumeFeedsBankAccountResponse,
Error,
ResumeFeedsBankAccountValues
>(
(values) =>
apiRequest.post(
`/banking/bank_accounts/${values.bankAccountId}/resume_feeds`,
),
{
onSuccess: (res, values) => {
queryClient.invalidateQueries([t.ACCOUNT, values.bankAccountId]);
},
...options,
},
);
}