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

pushing the contract u[pdate on client side

This commit is contained in:
Cevo 2015-09-03 17:19:29 +02:00
parent 8a75e94413
commit 57c4076c1e
2 changed files with 18 additions and 8 deletions

View File

@ -2,6 +2,7 @@
import alt from '../alt';
import OwnershipFetcher from '../fetchers/ownership_fetcher';
import Q from 'q';
class ContractListActions {
constructor() {
@ -23,13 +24,17 @@ class ContractListActions {
}
makeContractPublic(contract){
OwnershipFetcher.makeContractPublic(contract)
.then((res) =>{
return res;
})
.catch((err)=>{
console.logGlobal(err);
});
contract.public=true;
return Q.Promise((resolve, reject) => {
OwnershipFetcher.makeContractPublic(contract)
.then((res) => {
resolve(res);
})
.catch((err)=> {
console.logGlobal(err);
reject(err);
});
});
}
}

View File

@ -11,6 +11,8 @@ import ContractListActions from '../../actions/contract_list_actions';
import ActionPanel from '../ascribe_panel/action_panel';
import { getLangText } from '../../utils/lang_utils';
import GlobalNotificationModel from '../../models/global_notification_model';
import GlobalNotificationActions from '../../actions/global_notification_actions';
let ContractSettings = React.createClass({
propTypes: {
@ -33,7 +35,10 @@ let ContractSettings = React.createClass({
console.log(contract);
ContractListActions.makeContractPublic(contract)
.then(( ) => ContractListActions.fetchContractList())
.catch((error)=>{console.log("Error ", error)})
.catch((error)=>{console.log("Error ", error);
let notification = new GlobalNotificationModel("Service is unavailable", 'danger', 10000);
GlobalNotificationActions.appendGlobalNotification(notification);
})
},
getPublicContracts(){
return this.state.contractList.filter((contract) => contract.public);