mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
PR fixes
This commit is contained in:
parent
ea4805caa0
commit
55f5d959ff
@ -13,7 +13,7 @@ class CoaActions {
|
||||
);
|
||||
}
|
||||
|
||||
fetchOne(id) {
|
||||
fetchOrCreate(id, bitcoinId) {
|
||||
return Q.Promise((resolve, reject) => {
|
||||
CoaFetcher.fetchOne(id)
|
||||
.then((res) => {
|
||||
@ -22,10 +22,8 @@ class CoaActions {
|
||||
resolve(res.coa);
|
||||
}
|
||||
else {
|
||||
this.actions.updateCoa(null);
|
||||
resolve(null);
|
||||
this.actions.create(bitcoinId);
|
||||
}
|
||||
|
||||
})
|
||||
.catch((err) => {
|
||||
console.logGlobal(err);
|
||||
@ -35,9 +33,9 @@ class CoaActions {
|
||||
});
|
||||
}
|
||||
|
||||
create(edition) {
|
||||
create(bitcoinId) {
|
||||
return Q.Promise((resolve, reject) => {
|
||||
CoaFetcher.create(edition.bitcoin_id)
|
||||
CoaFetcher.create(bitcoinId)
|
||||
.then((res) => {
|
||||
this.actions.updateCoa(res.coa);
|
||||
})
|
||||
|
@ -336,17 +336,13 @@ let CoaDetails = React.createClass({
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
let { edition } = this.props;
|
||||
CoaStore.listen(this.onChange);
|
||||
if(this.props.edition.coa) {
|
||||
CoaActions.fetchOne(this.props.edition.coa)
|
||||
.then((res) => {
|
||||
if (res === null){
|
||||
CoaActions.create(this.props.edition);
|
||||
}
|
||||
});
|
||||
if(edition.coa) {
|
||||
CoaActions.fetchOrCreate(edition.coa, edition.bitcoin_id);
|
||||
}
|
||||
else {
|
||||
CoaActions.create(this.props.edition);
|
||||
CoaActions.create(edition.bitcoin_id);
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user