diff --git a/js/components/ascribe_detail/edition.js b/js/components/ascribe_detail/edition.js
index d12d2a41..fbc13a50 100644
--- a/js/components/ascribe_detail/edition.js
+++ b/js/components/ascribe_detail/edition.js
@@ -269,6 +269,8 @@ let CoaDetails = React.createClass({
return (
+
{getLangText("Just a sec, we\'re generating your COA")}
+
{getLangText('(you may leave the page)')}
);
}
diff --git a/js/components/ascribe_detail/edition_container.js b/js/components/ascribe_detail/edition_container.js
index add06ccd..24010d47 100644
--- a/js/components/ascribe_detail/edition_container.js
+++ b/js/components/ascribe_detail/edition_container.js
@@ -64,8 +64,7 @@ let EditionContainer = React.createClass({
componentDidUpdate() {
const { editionMeta } = this.state;
-
- if(editionMeta.err && editionMeta.err.status === 404) {
+ if(editionMeta.err && editionMeta.err.json && editionMeta.err.json.status === 404) {
this.throws(new ResourceNotFoundError(getLangText("Oops, the edition you're looking for doesn't exist.")));
}
},
diff --git a/js/stores/edition_store.js b/js/stores/edition_store.js
index fbe070e1..6a129ac1 100644
--- a/js/stores/edition_store.js
+++ b/js/stores/edition_store.js
@@ -29,21 +29,30 @@ class EditionStore {
}
}
- onSuccessFetchEdition({ edition }) {
- this.editionMeta.err = null;
- this.editionMeta.idToFetch = null;
- this.edition = edition;
+ onSuccessFetchEdition(res) {
+ if(res && res.edition) {
+ this.edition = res.edition;
+ this.editionMeta.err = null;
+ this.editionMeta.idToFetch = null;
- if(this.edition && this.edition.coa && typeof this.edition.coa.constructor !== Object) {
- this.getInstance().lookupCoa();
- } else if(this.edition && !this.edition.coa && this.edition.acl.acl_coa) {
- this.getInstance().performCreateCoa();
+ if (this.edition.coa && this.edition.acl.acl_coa &&
+ typeof this.edition.coa.constructor !== Object) {
+ this.getInstance().lookupCoa();
+ } else if(!this.edition.coa && this.edition.acl.acl_coa) {
+ this.getInstance().performCreateCoa();
+ }
+ } else {
+ this.editionMeta.err = new Error('Problem fetching the edition');
}
}
- onSuccessFetchCoa({ coa }) {
- this.coaMeta.err = null;
- this.edition.coa = coa;
+ onSuccessFetchCoa(res) {
+ if (res && res.coa && this.edition) {
+ this.edition.coa = res.coa;
+ this.coaMeta.err = null;
+ } else {
+ this.coaMeta.err = new Error('Problem generating/fetching the COA');
+ }
}
onFlushEdition() {