mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
feat: wip preview invoice payment mail
This commit is contained in:
@@ -5,6 +5,8 @@ import {
|
||||
useQuery,
|
||||
UseMutationOptions,
|
||||
UseMutationResult,
|
||||
UseQueryOptions,
|
||||
UseQueryResult,
|
||||
} from 'react-query';
|
||||
import { useRequestQuery } from '../useQueryRequest';
|
||||
import { transformPagination, transformToCamelCase } from '@/utils';
|
||||
@@ -364,17 +366,28 @@ export function useSendSaleInvoiceMail(
|
||||
);
|
||||
}
|
||||
|
||||
export function useSaleInvoiceDefaultOptions(invoiceId, props) {
|
||||
return useRequestQuery(
|
||||
export interface GetSaleInvoiceDefaultOptionsResponse {
|
||||
to: Array<string>;
|
||||
from: Array<String>;
|
||||
subject: string;
|
||||
message: string;
|
||||
attachInvoice: boolean;
|
||||
formatArgs: Record<string, string>;
|
||||
}
|
||||
|
||||
export function useSaleInvoiceDefaultOptions(
|
||||
invoiceId: number,
|
||||
options?: UseQueryOptions<GetSaleInvoiceDefaultOptionsResponse>,
|
||||
): UseQueryResult<GetSaleInvoiceDefaultOptionsResponse> {
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useQuery<GetSaleInvoiceDefaultOptionsResponse>(
|
||||
[t.SALE_INVOICE_DEFAULT_OPTIONS, invoiceId],
|
||||
{
|
||||
method: 'get',
|
||||
url: `sales/invoices/${invoiceId}/mail`,
|
||||
},
|
||||
{
|
||||
select: (res) => res.data.data,
|
||||
...props,
|
||||
},
|
||||
() =>
|
||||
apiRequest
|
||||
.get(`/sales/invoices/${invoiceId}/mail`)
|
||||
.then((res) => transformToCamelCase(res.data?.data)),
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user