2015-05-19 13:45:19 +02:00
|
|
|
import AppConstants from '../constants/application_constants';
|
2015-06-02 13:48:01 +02:00
|
|
|
import { generateOrderingQueryParams } from '../utils/fetch_api_utils';
|
2015-06-01 14:22:04 +02:00
|
|
|
import fetch from '../utils/fetch';
|
2015-05-18 18:00:12 +02:00
|
|
|
|
2015-05-20 16:44:45 +02:00
|
|
|
|
2015-05-19 17:16:01 +02:00
|
|
|
let PieceListFetcher = {
|
2015-05-19 17:01:28 +02:00
|
|
|
/**
|
|
|
|
* Fetches a list of pieces from the API.
|
|
|
|
* Can be called with all supplied queryparams the API.
|
|
|
|
*/
|
2015-05-21 12:12:25 +02:00
|
|
|
fetch(page, pageSize, search, orderBy, orderAsc) {
|
2015-06-02 13:48:01 +02:00
|
|
|
let ordering = generateOrderingQueryParams(orderBy, orderAsc);
|
2015-06-01 14:22:04 +02:00
|
|
|
return fetch.get('pieces_list', { page, pageSize, search, ordering });
|
2015-05-18 18:00:12 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-05-20 16:44:45 +02:00
|
|
|
export default PieceListFetcher;
|