2015-06-05 11:06:36 +02:00
|
|
|
'use strict';
|
|
|
|
|
2015-06-16 13:48:48 +02:00
|
|
|
import requests from '../utils/requests';
|
2015-05-21 17:59:38 +02:00
|
|
|
|
2015-06-04 09:16:30 +02:00
|
|
|
import { generateOrderingQueryParams } from '../utils/fetch_api_utils';
|
2015-08-04 15:06:02 +02:00
|
|
|
import { mergeOptions } from '../utils/general_utils';
|
2015-05-21 17:59:38 +02:00
|
|
|
|
|
|
|
let EditionListFetcher = {
|
|
|
|
/**
|
|
|
|
* Fetches a list of editions from the API.
|
|
|
|
*/
|
2015-08-04 15:06:02 +02:00
|
|
|
fetch(pieceId, page, pageSize, orderBy, orderAsc, filterBy) {
|
2015-06-04 09:16:30 +02:00
|
|
|
let ordering = generateOrderingQueryParams(orderBy, orderAsc);
|
2015-08-04 15:06:02 +02:00
|
|
|
|
|
|
|
let queryParams = mergeOptions(
|
|
|
|
{
|
|
|
|
page,
|
|
|
|
pageSize,
|
|
|
|
ordering,
|
|
|
|
piece_id: pieceId
|
|
|
|
},
|
|
|
|
filterBy
|
|
|
|
);
|
|
|
|
|
|
|
|
return requests.get('editions_list', queryParams);
|
2015-05-21 17:59:38 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-06-01 17:43:38 +02:00
|
|
|
export default EditionListFetcher;
|