diff --git a/js/actions/contract_agreement_list_actions.js b/js/actions/contract_agreement_list_actions.js index 52c055a6..a5059ff0 100644 --- a/js/actions/contract_agreement_list_actions.js +++ b/js/actions/contract_agreement_list_actions.js @@ -90,9 +90,7 @@ class ContractAgreementListActions { } flushContractAgreementList(){ - return Q.Promise((resolve, reject) => { - return this.actions.updateContractAgreementList(null); - }); + this.actions.updateContractAgreementList(null); } } diff --git a/js/components/ascribe_forms/form_loan.js b/js/components/ascribe_forms/form_loan.js index 1b37a116..f8946486 100644 --- a/js/components/ascribe_forms/form_loan.js +++ b/js/components/ascribe_forms/form_loan.js @@ -77,24 +77,18 @@ let LoanForm = React.createClass({ }, getContractAgreementsOrCreatePublic(email){ - /* a more complex defer (with promises) otherwise we dispatch while an action is being dispatched) */ - window.setTimeout(() => { - ContractAgreementListActions.flushContractAgreementList() - .catch((err) => { - console.logGlobal(err); - }); - - if (email) { - // fetch the available contractagreements (pending/accepted) - ContractAgreementListActions.fetchAvailableContractAgreementList(email).then( - (contractAgreementList) => { - if (!contractAgreementList && this.props.createPublicContractAgreement) { - // for public contracts: fetch the public contract and create a contractagreement if available - ContractAgreementListActions.createContractAgreementFromPublicContract(email); - } + ContractAgreementListActions.flushContractAgreementList(); + if (email) { + // fetch the available contractagreements (pending/accepted) + ContractAgreementListActions.fetchAvailableContractAgreementList(email).then( + (contractAgreementList) => { + if (!contractAgreementList && this.props.createPublicContractAgreement) { + // for public contracts: fetch the public contract and create a contractagreement if available + ContractAgreementListActions.createContractAgreementFromPublicContract(email); } - ); - }}, 0); + } + ); + } }, getFormData(){