1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-28 00:28:00 +02:00

fix PR comments

This commit is contained in:
diminator 2015-09-15 13:22:52 +02:00
parent 9085a2bafe
commit 71f94768d9
3 changed files with 13 additions and 4 deletions

View File

@ -37,11 +37,11 @@ class ContractAgreementListActions {
fetchAvailableContractAgreementList(issuer){ fetchAvailableContractAgreementList(issuer){
return Q.Promise((resolve, reject) => { return Q.Promise((resolve, reject) => {
this.actions.fetchContractAgreementList(issuer, 'True', null) this.actions.fetchContractAgreementList(issuer, true, null)
.then((contractAgreementListAccepted) => { .then((contractAgreementListAccepted) => {
if (!contractAgreementListAccepted) { if (!contractAgreementListAccepted) {
// fetch pending agreements if no accepted ones // fetch pending agreements if no accepted ones
return this.actions.fetchContractAgreementList(issuer, null, 'True'); return this.actions.fetchContractAgreementList(issuer, null, true);
} }
else { else {
resolve(contractAgreementListAccepted); resolve(contractAgreementListAccepted);

View File

@ -21,7 +21,7 @@ let AclProxy = React.createClass({
}, },
getChildren() { getChildren() {
if (this.props.children.length && this.props.children.length > 1){ if (React.Children.count(this.props.children) > 1){
/* /*
This might ruin styles for header items in the navbar etc This might ruin styles for header items in the navbar etc
*/ */

View File

@ -57,6 +57,15 @@ let LoanForm = React.createClass({
this.getContractAgreementsOrCreatePublic(this.props.email); this.getContractAgreementsOrCreatePublic(this.props.email);
}, },
componentWillReceiveProps(nextProps) {
// however, it can also be that at the time the component is mounting,
// the email is not defined (because it's asynchronously fetched from the server).
// Then we need to update it as soon as it is included into LoanForm's props.
if(nextProps && nextProps.email) {
this.getContractAgreementsOrCreatePublic(nextProps.email);
}
},
componentWillUnmount() { componentWillUnmount() {
ContractAgreementListStore.unlisten(this.onChange); ContractAgreementListStore.unlisten(this.onChange);
}, },
@ -70,7 +79,7 @@ let LoanForm = React.createClass({
ContractAgreementListActions.fetchAvailableContractAgreementList(email).then( ContractAgreementListActions.fetchAvailableContractAgreementList(email).then(
(contractAgreementList) => { (contractAgreementList) => {
if (!contractAgreementList) { if (!contractAgreementList) {
ContractAgreementListActions.createContractAgreementFromPublicContract.defer(email); ContractAgreementListActions.createContractAgreementFromPublicContract(email);
} }
} }
); );