diff --git a/js/actions/coa_actions.js b/js/actions/coa_actions.js index a7f36305..d3d13290 100644 --- a/js/actions/coa_actions.js +++ b/js/actions/coa_actions.js @@ -14,27 +14,27 @@ class CoaActions { } fetchOrCreate(id, bitcoinId) { - //return Q.Promise((resolve, reject) => { + return Q.Promise((resolve, reject) => { CoaFetcher.fetchOne(id) .then((res) => { if (res.coa) { this.actions.updateCoa(res.coa); - //resolve(res.coa); + resolve(res.coa); } else { - this.actions.create(bitcoinId).defer(); + this.actions.create(bitcoinId); } }) .catch((err) => { console.logGlobal(err); this.actions.updateCoa(null); - //reject(err); + reject(err); }); - //}); + }); } create(bitcoinId) { - //return Q.Promise((resolve, reject) => { + return Q.Promise((resolve, reject) => { CoaFetcher.create(bitcoinId) .then((res) => { this.actions.updateCoa(res.coa); @@ -42,9 +42,9 @@ class CoaActions { .catch((err) => { console.logGlobal(err); this.actions.updateCoa(null); - //reject(err); + reject(err); }); - //}); + }); } } diff --git a/js/components/ascribe_detail/edition.js b/js/components/ascribe_detail/edition.js index 3c88e022..bc2f0cfa 100644 --- a/js/components/ascribe_detail/edition.js +++ b/js/components/ascribe_detail/edition.js @@ -256,7 +256,6 @@ let CoaDetails = React.createClass({ componentDidMount() { let { edition } = this.props; CoaStore.listen(this.onChange); - CoaActions.updateCoa({}); if(edition.coa) { CoaActions.fetchOrCreate(edition.coa, edition.bitcoin_id); } @@ -301,7 +300,7 @@ let CoaDetails = React.createClass({ } return (
- +
); }