mirror of
https://github.com/ascribe/onion.git
synced 2025-02-08 10:27:33 +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 alt from '../alt';
|
||||||
import OwnershipFetcher from '../fetchers/ownership_fetcher';
|
import OwnershipFetcher from '../fetchers/ownership_fetcher';
|
||||||
|
import Q from 'q';
|
||||||
|
|
||||||
class ContractListActions {
|
class ContractListActions {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -23,12 +24,16 @@ class ContractListActions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
makeContractPublic(contract){
|
makeContractPublic(contract){
|
||||||
|
contract.public=true;
|
||||||
|
return Q.Promise((resolve, reject) => {
|
||||||
OwnershipFetcher.makeContractPublic(contract)
|
OwnershipFetcher.makeContractPublic(contract)
|
||||||
.then((res) =>{
|
.then((res) => {
|
||||||
return res;
|
resolve(res);
|
||||||
})
|
})
|
||||||
.catch((err)=>{
|
.catch((err)=> {
|
||||||
console.logGlobal(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 ActionPanel from '../ascribe_panel/action_panel';
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang_utils';
|
import { getLangText } from '../../utils/lang_utils';
|
||||||
|
import GlobalNotificationModel from '../../models/global_notification_model';
|
||||||
|
import GlobalNotificationActions from '../../actions/global_notification_actions';
|
||||||
|
|
||||||
let ContractSettings = React.createClass({
|
let ContractSettings = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
@ -33,7 +35,10 @@ let ContractSettings = React.createClass({
|
|||||||
console.log(contract);
|
console.log(contract);
|
||||||
ContractListActions.makeContractPublic(contract)
|
ContractListActions.makeContractPublic(contract)
|
||||||
.then(( ) => ContractListActions.fetchContractList())
|
.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(){
|
getPublicContracts(){
|
||||||
return this.state.contractList.filter((contract) => contract.public);
|
return this.state.contractList.filter((contract) => contract.public);
|
||||||
|
Loading…
Reference in New Issue
Block a user