1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 09:23:13 +01:00

Fix 404 not being detected properly on piece and edition detail

This commit is contained in:
Brett Sun 2016-01-15 13:00:09 +01:00
parent bc7515ffe7
commit 587b58a500
2 changed files with 5 additions and 4 deletions

View File

@ -51,14 +51,15 @@ let EditionContainer = React.createClass({
// This is done to update the container when the user clicks on the prev or next
// button to update the URL parameter (and therefore to switch pieces)
componentWillReceiveProps(nextProps) {
if(this.props.params.editionId !== nextProps.params.editionId) {
if (this.props.params.editionId !== nextProps.params.editionId) {
EditionActions.flushEdition();
this.loadEdition(nextProps.params.editionId);
}
},
componentDidUpdate() {
const { editionErr } = this.state.editionMeta;
const { err: editionErr } = this.state.editionMeta;
if (editionErr && editionErr.json && editionErr.json.status === 404) {
this.throws(new ResourceNotFoundError(getLangText("Oops, the edition you're looking for doesn't exist.")));
}

View File

@ -96,9 +96,9 @@ let PieceContainer = React.createClass({
},
componentDidUpdate() {
const { pieceMeta: { err: pieceErr } } = this.state;
const { err: pieceErr } = this.state.pieceMeta;
if (pieceErr && pieceErr.status === 404) {
if (pieceErr && pieceErr.json && pieceErr.json.status === 404) {
this.throws(new ResourceNotFoundError(getLangText("Oops, the piece you're looking for doesn't exist.")));
}
},