mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 18:35:09 +01:00
Cleanup window.setTimeout
This commit is contained in:
parent
63fffc2132
commit
780ab9f7f1
@ -90,9 +90,7 @@ class ContractAgreementListActions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
flushContractAgreementList(){
|
flushContractAgreementList(){
|
||||||
return Q.Promise((resolve, reject) => {
|
this.actions.updateContractAgreementList(null);
|
||||||
return this.actions.updateContractAgreementList(null);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -77,24 +77,18 @@ 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(() => {
|
if (email) {
|
||||||
ContractAgreementListActions.flushContractAgreementList()
|
// fetch the available contractagreements (pending/accepted)
|
||||||
.catch((err) => {
|
ContractAgreementListActions.fetchAvailableContractAgreementList(email).then(
|
||||||
console.logGlobal(err);
|
(contractAgreementList) => {
|
||||||
});
|
if (!contractAgreementList && this.props.createPublicContractAgreement) {
|
||||||
|
// for public contracts: fetch the public contract and create a contractagreement if available
|
||||||
if (email) {
|
ContractAgreementListActions.createContractAgreementFromPublicContract(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(){
|
getFormData(){
|
||||||
|
Loading…
Reference in New Issue
Block a user