mirror of
https://github.com/ascribe/onion.git
synced 2025-01-20 17:51:25 +01:00
bug fix promises and notifications
This commit is contained in:
parent
e3b85bf808
commit
bcd6400a78
@ -62,7 +62,7 @@ class PrizeRatingActions {
|
|||||||
PrizeRatingFetcher
|
PrizeRatingFetcher
|
||||||
.select(pieceId)
|
.select(pieceId)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.actions.updatePrizeRating(res.rating.rating);
|
this.actions.updatePrizeRatings(res.data.ratings);
|
||||||
resolve(res);
|
resolve(res);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
@ -264,9 +264,15 @@ let PrizePieceRatings = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
handleLoanRequestSuccess(){},
|
handleLoanRequestSuccess(){},
|
||||||
|
handleShortlistSuccess(message){
|
||||||
|
let notification = new GlobalNotificationModel(message, 'success', 2000);
|
||||||
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
},
|
||||||
|
|
||||||
refreshPieceData() {
|
refreshPieceData() {
|
||||||
this.props.loadPiece();
|
this.props.loadPiece();
|
||||||
|
PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search,
|
||||||
|
this.state.orderBy, this.state.orderAsc, this.state.filterBy);
|
||||||
},
|
},
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
@ -282,8 +288,16 @@ let PrizePieceRatings = React.createClass({
|
|||||||
<InputCheckbox
|
<InputCheckbox
|
||||||
defaultChecked={this.props.piece.selected}
|
defaultChecked={this.props.piece.selected}
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
PrizeRatingActions.toggleShortlist(this.props.piece.id).then(
|
PrizeRatingActions.toggleShortlist(this.props.piece.id)
|
||||||
this.refreshPieceData()
|
.then(
|
||||||
|
(res) => {
|
||||||
|
this.refreshPieceData();
|
||||||
|
return res;
|
||||||
|
})
|
||||||
|
.then(
|
||||||
|
(res) => {
|
||||||
|
this.handleShortlistSuccess(res.notification);
|
||||||
|
}
|
||||||
); }}>
|
); }}>
|
||||||
<span>
|
<span>
|
||||||
Select for the prize
|
Select for the prize
|
||||||
|
Loading…
Reference in New Issue
Block a user