mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 09:35:10 +01:00
45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
import alt from '../alt';
|
|
|
|
import PieceListFetcher from '../fetchers/piece_list_fetcher';
|
|
|
|
|
|
class PieceListActions {
|
|
constructor() {
|
|
this.generateActions(
|
|
'updatePieceList',
|
|
'updatePieceListRequestActions'
|
|
);
|
|
}
|
|
|
|
fetchPieceList(page, pageSize, search, orderBy, orderAsc) {
|
|
return new Promise((resolve, reject) => {
|
|
PieceListFetcher
|
|
.fetch(page, pageSize, search, orderBy, orderAsc)
|
|
.then((res) => {
|
|
this.actions.updatePieceList({
|
|
page,
|
|
pageSize,
|
|
search,
|
|
orderBy,
|
|
orderAsc,
|
|
'pieceList': res.pieces,
|
|
'pieceListCount': res.count
|
|
});
|
|
resolve();
|
|
});
|
|
});
|
|
}
|
|
fetchPieceRequestActions() {
|
|
PieceListFetcher
|
|
.fetchRequestActions()
|
|
.then((res) => {
|
|
this.actions.updatePieceListRequestActions(res.piece_ids);
|
|
});
|
|
}
|
|
|
|
}
|
|
|
|
export default alt.createActions(PieceListActions);
|