diff --git a/js/actions/contract_list_actions.js b/js/actions/contract_list_actions.js index 5248203f..aaee33c6 100644 --- a/js/actions/contract_list_actions.js +++ b/js/actions/contract_list_actions.js @@ -44,12 +44,8 @@ class ContractListActions { resolve(res); }) .catch( (err) => { - if(typeof err === 'undefined') { - resolve(err); - } - else{ - reject(err); - } + console.logGlobal(err); + reject(err); }); }); } diff --git a/js/components/ascribe_forms/form_contract_agreement.js b/js/components/ascribe_forms/form_contract_agreement.js index 783f6696..c2f2b810 100644 --- a/js/components/ascribe_forms/form_contract_agreement.js +++ b/js/components/ascribe_forms/form_contract_agreement.js @@ -56,8 +56,7 @@ let ContractAgreementForm = React.createClass({ }, getFormData(){ - return {'appendix': {'default': this.refs.form.refs.appendix.state.value}, - 'contract': this.state.contractList[this.state.selectedContract].id}; + return {'appendix': {'default': this.refs.form.refs.appendix.state.value}}; }, getContracts() { diff --git a/js/components/ascribe_forms/form_create_contract.js b/js/components/ascribe_forms/form_create_contract.js index 69404055..ee26adfc 100644 --- a/js/components/ascribe_forms/form_create_contract.js +++ b/js/components/ascribe_forms/form_create_contract.js @@ -50,12 +50,12 @@ let CreateContractForm = React.createClass({ }, handleCreateSuccess(response) { - ContractListActions.fetchContractList(); + ContractListActions.fetchContractList({is_active: 'True'}); let notification = new GlobalNotificationModel(getLangText('Contract %s successfully created', response.name), 'success', 5000); GlobalNotificationActions.appendGlobalNotification(notification); - - // also refresh contract lists for the rest of the contract settings page - ContractListActions.fetchContractList(); + // + //// also refresh contract lists for the rest of the contract settings page + //ContractListActions.fetchContractList(); }, diff --git a/js/components/ascribe_settings/contract_settings.js b/js/components/ascribe_settings/contract_settings.js index 87c64bf4..278c4c1b 100644 --- a/js/components/ascribe_settings/contract_settings.js +++ b/js/components/ascribe_settings/contract_settings.js @@ -26,7 +26,7 @@ let ContractSettings = React.createClass({ componentDidMount() { ContractListStore.listen(this.onChange); - ContractListActions.fetchContractList(); + ContractListActions.fetchContractList({is_active: 'True'}); }, componentWillUnmount() { @@ -41,22 +41,31 @@ let ContractSettings = React.createClass({ return () => { contract.is_public = true; ContractListActions.changeContract(contract) - .then(() => ContractListActions.fetchContractList()) + .then(() => { + ContractListActions.fetchContractList({is_active: 'True'}); + let notification = getLangText('Contract %s is now public', contract.name); + notification = new GlobalNotificationModel(notification, 'success', 4000); + GlobalNotificationActions.appendGlobalNotification(notification); + }) .catch((err) => { let notification = new GlobalNotificationModel(err, 'danger', 10000); GlobalNotificationActions.appendGlobalNotification(notification); - }); + }); }; }, removeContract(contract) { return () => { ContractListActions.removeContract(contract.id) - .then(( ) => ContractListActions.fetchContractList()) + .then((response) => { + ContractListActions.fetchContractList({is_active: 'True'}); + let notification = new GlobalNotificationModel(response.notification, 'success', 4000); + GlobalNotificationActions.appendGlobalNotification(notification); + }) .catch((err) => { let notification = new GlobalNotificationModel(err, 'danger', 10000); GlobalNotificationActions.appendGlobalNotification(notification); - }); + }); }; }, diff --git a/js/fetchers/ownership_fetcher.js b/js/fetchers/ownership_fetcher.js index 02990f3a..c0d32d71 100644 --- a/js/fetchers/ownership_fetcher.js +++ b/js/fetchers/ownership_fetcher.js @@ -24,7 +24,6 @@ let OwnershipFetcher = { }, makeContractPublic(contractObj){ - console.log(ApiUrls.ownership_contract); return requests.put(ApiUrls.ownership_contract, { body: contractObj, contract_id: contractObj.id }); },