mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
feat: Assign default PDF template automatically
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// @ts-nocheck
|
||||
import { useQueryClient, useMutation } from 'react-query';
|
||||
import { useQueryClient, useMutation, useQuery } from 'react-query';
|
||||
import { useRequestQuery } from '../useQueryRequest';
|
||||
import { transformPagination } from '@/utils';
|
||||
import { transformPagination, transformToCamelCase } from '@/utils';
|
||||
import useApiRequest from '../useRequest';
|
||||
import { useRequestPdf } from '../useRequestPdf';
|
||||
import t from './types';
|
||||
@@ -341,3 +341,22 @@ export function useSaleInvoiceDefaultOptions(invoiceId, props) {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export interface GetSaleInvoiceStateResponse {
|
||||
defaultTemplateId: number;
|
||||
}
|
||||
|
||||
export function useGetSaleInvoiceState(
|
||||
options?: UseQueryOptions<GetSaleInvoiceStateResponse, Error>,
|
||||
): UseQueryResult<GetSaleInvoiceStateResponse, Error> {
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useQuery<GetSaleInvoiceStateResponse, Error>(
|
||||
['SALE_INVOICE_STATE'],
|
||||
() =>
|
||||
apiRequest
|
||||
.get(`/sales/invoices/state`)
|
||||
.then((res) => transformToCamelCase(res.data?.data)),
|
||||
{ ...options },
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user