1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-05 11:25:09 +01:00

Cleanup window.setTimeout

This commit is contained in:
Tim Daubenschütz 2015-09-17 13:28:59 +02:00
parent 63fffc2132
commit 780ab9f7f1
2 changed files with 12 additions and 20 deletions

View File

@ -90,9 +90,7 @@ class ContractAgreementListActions {
} }
flushContractAgreementList(){ flushContractAgreementList(){
return Q.Promise((resolve, reject) => { this.actions.updateContractAgreementList(null);
return this.actions.updateContractAgreementList(null);
});
} }
} }

View File

@ -77,13 +77,7 @@ let LoanForm = React.createClass({
}, },
getContractAgreementsOrCreatePublic(email){ getContractAgreementsOrCreatePublic(email){
/* a more complex defer (with promises) otherwise we dispatch while an action is being dispatched) */ ContractAgreementListActions.flushContractAgreementList();
window.setTimeout(() => {
ContractAgreementListActions.flushContractAgreementList()
.catch((err) => {
console.logGlobal(err);
});
if (email) { if (email) {
// fetch the available contractagreements (pending/accepted) // fetch the available contractagreements (pending/accepted)
ContractAgreementListActions.fetchAvailableContractAgreementList(email).then( ContractAgreementListActions.fetchAvailableContractAgreementList(email).then(
@ -94,7 +88,7 @@ let LoanForm = React.createClass({
} }
} }
); );
}}, 0); }
}, },
getFormData(){ getFormData(){