mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
30 lines
729 B
JavaScript
30 lines
729 B
JavaScript
'use strict';
|
|
|
|
import requests from '../utils/requests';
|
|
|
|
import { generateOrderingQueryParams } from '../utils/fetch_api_utils';
|
|
import { mergeOptions } from '../utils/general_utils';
|
|
|
|
let EditionListFetcher = {
|
|
/**
|
|
* Fetches a list of editions from the API.
|
|
*/
|
|
fetch(pieceId, page, pageSize, orderBy, orderAsc, filterBy) {
|
|
let ordering = generateOrderingQueryParams(orderBy, orderAsc);
|
|
|
|
let queryParams = mergeOptions(
|
|
{
|
|
page,
|
|
pageSize,
|
|
ordering,
|
|
piece_id: pieceId
|
|
},
|
|
filterBy
|
|
);
|
|
|
|
return requests.get('editions_list', queryParams);
|
|
}
|
|
};
|
|
|
|
export default EditionListFetcher;
|