1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

Merged in AD-992-im-on-page-3-i-deleted-an-edition (pull request #86)

Ad 992 im on page 3 i deleted an edition
This commit is contained in:
TimDaubenschuetz 2015-09-30 17:48:12 +02:00
commit ccc7bf9c06
3 changed files with 15 additions and 4 deletions

View File

@ -33,6 +33,10 @@ class EditionListActions {
EditionListFetcher EditionListFetcher
.fetch(pieceId, page, pageSize, orderBy, orderAsc, filterBy) .fetch(pieceId, page, pageSize, orderBy, orderAsc, filterBy)
.then((res) => { .then((res) => {
if(res && !res.editions) {
throw new Error('Piece has no editions to fetch.');
}
this.actions.updateEditionList({ this.actions.updateEditionList({
pieceId, pieceId,
page, page,
@ -46,6 +50,7 @@ class EditionListActions {
resolve(res); resolve(res);
}) })
.catch((err) => { .catch((err) => {
console.logGlobal(err);
reject(err); reject(err);
}); });
}); });

View File

@ -33,21 +33,28 @@ let PieceListBulkModal = React.createClass({
); );
}, },
onChange(state) {
this.setState(state);
},
componentDidMount() { componentDidMount() {
EditionListStore.listen(this.onChange); EditionListStore.listen(this.onChange);
UserStore.listen(this.onChange); UserStore.listen(this.onChange);
PieceListStore.listen(this.onChange);
UserActions.fetchCurrentUser(); UserActions.fetchCurrentUser();
PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search,
this.state.orderBy, this.state.orderAsc, this.state.filterBy);
}, },
componentWillUnmount() { componentWillUnmount() {
EditionListStore.unlisten(this.onChange); EditionListStore.unlisten(this.onChange);
PieceListStore.unlisten(this.onChange);
UserStore.unlisten(this.onChange); UserStore.unlisten(this.onChange);
}, },
onChange(state) {
this.setState(state);
},
fetchSelectedPieceEditionList() { fetchSelectedPieceEditionList() {
let filteredPieceIdList = Object.keys(this.state.editionList) let filteredPieceIdList = Object.keys(this.state.editionList)
.filter((pieceId) => { .filter((pieceId) => {

View File

@ -13,7 +13,6 @@ class EditionListStore {
} }
onUpdateEditionList({pieceId, editionListOfPiece, page, pageSize, orderBy, orderAsc, count, filterBy}) { onUpdateEditionList({pieceId, editionListOfPiece, page, pageSize, orderBy, orderAsc, count, filterBy}) {
/* /*
Basically there are two modes an edition list can be updated. Basically there are two modes an edition list can be updated.