Skip to content

Commit

Permalink
Merge pull request #242 from Runekid/221-validating-the-invoice-in-th…
Browse files Browse the repository at this point in the history
…e-invoices-tab-then-clicking-save-reverts-the-change-to-the-invoice

verified flag is also updated on edited invoice object
  • Loading branch information
Laoujin authored Apr 9, 2023
2 parents eb08a8d + 30b842e commit f1e0e62
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions frontend/src/components/invoice/invoice-edit/EditInvoice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ const EditInvoice = () => {
)}
<EditInvoiceSaveButtons
onClick={(type, navigate) => {
// When the InvoiceNotVerifiedAlert component updates the verified flag to true on initInvoice,
// it doesn't update on the edited object invoice. So the verified flag is overridden when you save
// the edited object invoice. This if check fixes that
if (initInvoice.verified !== invoice.verified) {
invoice.verified = initInvoice.verified;
}
if (type === 'create') {
dispatch(createInvoice(invoice, navigate) as any);
} if (type === 'preview') {
Expand Down

0 comments on commit f1e0e62

Please sign in to comment.