mirror of
https://github.com/ascribe/onion.git
synced 2025-02-01 20:39:57 +01:00
pushing the contract u[pdate on client side
This commit is contained in:
parent
8a75e94413
commit
57c4076c1e
@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user