From 089c4ad009c19adb8561dafa4b04b4e21fd5db55 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Thu, 17 Dec 2015 18:47:47 +0100 Subject: [PATCH] Small fixes and destructuring --- .../components/ascribe_detail/prize_piece_container.js | 6 +++++- .../prize/simple_prize/components/prize_piece_list.js | 5 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/js/components/whitelabel/prize/simple_prize/components/ascribe_detail/prize_piece_container.js b/js/components/whitelabel/prize/simple_prize/components/ascribe_detail/prize_piece_container.js index 6e1ea3b0..a49eac68 100644 --- a/js/components/whitelabel/prize/simple_prize/components/ascribe_detail/prize_piece_container.js +++ b/js/components/whitelabel/prize/simple_prize/components/ascribe_detail/prize_piece_container.js @@ -75,7 +75,7 @@ let PieceContainer = React.createClass({ // the piece detail a second time PieceActions.updatePiece({}); - PieceActions.fetchOne(this.props.params.pieceId); + this.loadPiece(); UserActions.fetchCurrentUser(); }, @@ -119,6 +119,10 @@ let PieceContainer = React.createClass({ } }, + loadPiece() { + PieceActions.fetchOne(this.props.params.pieceId); + }, + render() { const { currentUser, piece } = this.state; diff --git a/js/components/whitelabel/prize/simple_prize/components/prize_piece_list.js b/js/components/whitelabel/prize/simple_prize/components/prize_piece_list.js index 972b3fac..23cdbb23 100644 --- a/js/components/whitelabel/prize/simple_prize/components/prize_piece_list.js +++ b/js/components/whitelabel/prize/simple_prize/components/prize_piece_list.js @@ -48,9 +48,8 @@ let PrizePieceList = React.createClass({ }, getButtonSubmit() { - const { currentUser } = this.state; - if (this.state.prize && this.state.prize.active && - !currentUser.is_jury && !currentUser.is_admin && !currentUser.is_judge){ + const { currentUser, prize } = this.state; + if (prize && prize.active && !currentUser.is_jury && !currentUser.is_admin && !currentUser.is_judge) { return (