1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-30 13:41:57 +02:00
onion/js/actions/edition_list_actions.js

36 lines
955 B
JavaScript
Raw Normal View History

import alt from '../alt';
import EditionListFetcher from '../fetchers/edition_list_fetcher.js';
class EditionListActions {
constructor() {
this.generateActions(
2015-05-26 16:48:48 +02:00
'updateEditionList',
2015-06-01 15:12:31 +02:00
'selectEdition',
'clearAllEditionSelections'
);
}
fetchEditionList(pieceId, orderBy, orderAsc) {
if(!orderBy && typeof orderAsc == "undefined") {
orderBy = 'edition_number';
orderAsc = true;
}
EditionListFetcher
.fetch(pieceId, orderBy, orderAsc)
.then((res) => {
2015-05-26 13:14:35 +02:00
this.actions.updateEditionList({
2015-05-26 16:48:48 +02:00
'editionListOfPiece': res.editions,
pieceId,
orderBy,
orderAsc
2015-05-26 13:14:35 +02:00
});
})
.catch((err) => {
console.log(err);
});
}
2015-05-26 13:33:35 +02:00
}
export default alt.createActions(EditionListActions);