Skip to content

Commit

Permalink
Updated FormMW
Browse files Browse the repository at this point in the history
Make sure updateInvoice now take only one argument
  • Loading branch information
hql287 committed Mar 2, 2018
1 parent 848a124 commit 90c1450
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/middlewares/FormMW.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ const FormMW = ({ dispatch, getState }) => next => action => {
// Validate Form Data
if (!validateFormData(currentFormData)) return;
const currentInvoiceData = getInvoiceData(currentFormData);
// Check Edit Mode
// UPDATE DOC
if (currentFormData.settings.editMode.active) {
const invoiceId = currentFormData.settings.editMode.data._id;
// Update existing invoice
dispatch(InvoicesActions.updateInvoice(invoiceId, currentInvoiceData));
dispatch(InvoicesActions.updateInvoice(currentInvoiceData));
// Change Tab to invoices
dispatch(UIActions.changeActiveTab('invoices'));
} else {
// Save Invoice To DB
// CREATE DOC
dispatch(InvoicesActions.saveInvoice(currentInvoiceData));
}
// Save Contact to DB if it's a new one
Expand Down

0 comments on commit 90c1450

Please sign in to comment.