1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 09:35:10 +01:00
onion/js/actions/piece_list_actions.js

35 lines
867 B
JavaScript
Raw Normal View History

import alt from '../alt';
import PieceListFetcher from '../fetchers/piece_list_fetcher';
2015-05-20 16:44:45 +02:00
class PieceListActions {
constructor() {
this.generateActions(
'updatePieceList'
);
}
2015-05-22 11:33:38 +02:00
fetchPieceList(page, pageSize, search, orderBy, orderAsc) {
PieceListFetcher
.fetch(page, pageSize, search, orderBy, orderAsc)
.then((res) => {
2015-05-21 12:12:25 +02:00
this.actions.updatePieceList({
page,
pageSize,
search,
orderBy,
orderAsc,
'pieceList': res.pieces,
'pieceListCount': res.count
2015-05-21 12:12:25 +02:00
});
})
.catch((err) => {
console.log(err);
});
}
};
export default alt.createActions(PieceListActions);