2015-05-19 17:13:09 +02:00
|
|
|
import alt from '../alt';
|
2015-05-21 17:59:38 +02:00
|
|
|
|
2015-05-19 17:13:09 +02:00
|
|
|
import PieceListFetcher from '../fetchers/piece_list_fetcher';
|
|
|
|
|
2015-05-20 16:44:45 +02:00
|
|
|
|
2015-05-19 17:13:09 +02:00
|
|
|
class PieceListActions {
|
|
|
|
constructor() {
|
|
|
|
this.generateActions(
|
|
|
|
'updatePieceList'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2015-05-22 11:33:38 +02:00
|
|
|
fetchPieceList(page, pageSize, search, orderBy, orderAsc) {
|
2015-05-21 17:59:38 +02:00
|
|
|
PieceListFetcher
|
|
|
|
.fetch(page, pageSize, search, orderBy, orderAsc)
|
2015-05-19 17:13:09 +02:00
|
|
|
.then((res) => {
|
2015-06-01 14:22:04 +02:00
|
|
|
console.log(res);
|
2015-05-21 12:12:25 +02:00
|
|
|
this.actions.updatePieceList({
|
2015-05-21 17:54:27 +02:00
|
|
|
page,
|
|
|
|
pageSize,
|
|
|
|
search,
|
|
|
|
orderBy,
|
|
|
|
orderAsc,
|
2015-05-22 13:43:53 +02:00
|
|
|
'pieceList': res.pieces,
|
|
|
|
'pieceListCount': res.count
|
2015-05-21 12:12:25 +02:00
|
|
|
});
|
2015-05-19 17:13:09 +02:00
|
|
|
});
|
|
|
|
}
|
2015-05-21 17:54:27 +02:00
|
|
|
|
2015-05-19 17:13:09 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export default alt.createActions(PieceListActions);
|