diff --git a/src/components/invoice/invoice-creator.tsx b/src/components/invoice/invoice-creator.tsx index eb29013..93e1bcd 100644 --- a/src/components/invoice/invoice-creator.tsx +++ b/src/components/invoice/invoice-creator.tsx @@ -49,7 +49,7 @@ export function InvoiceCreator({ } toast.success("Invoice created successfully"); await utils.invoice.getAll.invalidate(); - router.push("/dashboard"); + router.push("/invoices"); }, onError: (error) => { toast.error("Failed to create invoice", { @@ -64,7 +64,7 @@ export function InvoiceCreator({ onSuccess: async () => { toast.success("Invoice created successfully"); await utils.invoice.getAll.invalidate(); - router.push("/dashboard"); + router.push("/invoices"); }, onError: (error) => { toast.error("Failed to create invoice", { diff --git a/src/components/invoice/invoice-form/invoice-form.tsx b/src/components/invoice/invoice-form/invoice-form.tsx index ee60eee..2fabb49 100644 --- a/src/components/invoice/invoice-form/invoice-form.tsx +++ b/src/components/invoice/invoice-form/invoice-form.tsx @@ -363,20 +363,8 @@ export function InvoiceForm({ async (data: InvoiceFormValues) => { // Prevent multiple submissions if (isSubmitting) return; - setIsSubmitting(true); - // If Crypto-to-fiat is enabled but no payment details are linked, show error - if (data.isCryptoToFiatAvailable && !data.paymentDetailsId) { - // Set form error for paymentDetailsId - form.setError("paymentDetailsId", { - type: "required", - message: "Please select a payment method for Crypto-to-fiat payment", - }); - setIsSubmitting(false); - return; - } - // Check if payment details have approved status if (data.isCryptoToFiatAvailable && data.paymentDetailsId) { const selectedPaymentDetail = linkedPaymentDetails?.find( @@ -429,13 +417,7 @@ export function InvoiceForm({ setIsSubmitting(false); } }, - [ - linkedPaymentDetails, - onSubmit, - form.setError, - isSubmitting, - handleBankAccountSuccess, - ], + [linkedPaymentDetails, onSubmit, isSubmitting, handleBankAccountSuccess], ); // Add timeout effect for pending approval modal @@ -755,7 +737,7 @@ export function InvoiceForm({
{fields.map((field, index) => ( -