mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
fix: Download invoice pdf of the payment link page
This commit is contained in:
@@ -43,9 +43,9 @@ export class PaymentLinksApplication {
|
|||||||
* Retrieves the sale invoice pdf of the given payment link id.
|
* Retrieves the sale invoice pdf of the given payment link id.
|
||||||
* @param {number} tenantId
|
* @param {number} tenantId
|
||||||
* @param {number} paymentLinkId
|
* @param {number} paymentLinkId
|
||||||
* @returns
|
* @returns {Promise<Buffer> }
|
||||||
*/
|
*/
|
||||||
public getPaymentLinkInvoicePdf(paymentLinkId: string) {
|
public getPaymentLinkInvoicePdf(paymentLinkId: string): Promise<Buffer> {
|
||||||
return this.getPaymentLinkInvoicePdfService.getPaymentLinkInvoicePdf(
|
return this.getPaymentLinkInvoicePdfService.getPaymentLinkInvoicePdf(
|
||||||
paymentLinkId
|
paymentLinkId
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -33,7 +33,11 @@ export function PaymentPortal() {
|
|||||||
const handleInvoiceDownloadBtnClick = () => {
|
const handleInvoiceDownloadBtnClick = () => {
|
||||||
generatePaymentLinkInvoice({ paymentLinkId: linkId })
|
generatePaymentLinkInvoice({ paymentLinkId: linkId })
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
downloadFile(data, `Invoice ${sharableLinkMeta?.invoiceNo}.pdf`);
|
downloadFile(
|
||||||
|
data,
|
||||||
|
`Invoice ${sharableLinkMeta?.invoiceNo}`,
|
||||||
|
'application/pdf',
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
AppToaster.show({
|
AppToaster.show({
|
||||||
|
|||||||
@@ -200,7 +200,10 @@ export const useGeneratePaymentLinkInvoicePdf = (
|
|||||||
>(
|
>(
|
||||||
(values: GeneratePaymentLinkInvoicePdfValues) => {
|
(values: GeneratePaymentLinkInvoicePdfValues) => {
|
||||||
return apiRequest
|
return apiRequest
|
||||||
.get(`/payment-links/${values.paymentLinkId}/invoice/pdf`)
|
.get(`/payment-links/${values.paymentLinkId}/invoice/pdf`, {
|
||||||
|
responseType: 'blob',
|
||||||
|
headers: { accept: 'application/pdf' },
|
||||||
|
})
|
||||||
.then((res) => res?.data);
|
.then((res) => res?.data);
|
||||||
},
|
},
|
||||||
{ ...options },
|
{ ...options },
|
||||||
@@ -217,7 +220,10 @@ export const useGetPaymentLinkInvoicePdf = (
|
|||||||
[GetPaymentLinkInvoicePdf, invoiceId],
|
[GetPaymentLinkInvoicePdf, invoiceId],
|
||||||
() =>
|
() =>
|
||||||
apiRequest
|
apiRequest
|
||||||
.get(`/payment-links/${invoiceId}/invoice/pdf`)
|
.get(`/payment-links/${invoiceId}/invoice/pdf`, {
|
||||||
|
responseType: 'blob',
|
||||||
|
headers: { accept: 'application/pdf' },
|
||||||
|
})
|
||||||
.then((res) => res.data),
|
.then((res) => res.data),
|
||||||
{
|
{
|
||||||
...options,
|
...options,
|
||||||
|
|||||||
Reference in New Issue
Block a user