1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 09:50:31 +01:00
onion/js/fetchers/edition_list_fetcher.js

30 lines
719 B
JavaScript

'use strict';
import requests from '../utils/requests';
import { mergeOptions } from '../utils/general';
import { generateOrderingQueryParams } from '../utils/url';
let EditionListFetcher = {
/**
* Fetches a list of editions from the API.
*/
fetch({ pieceId, page, pageSize, orderBy, orderAsc, filterBy }) {
const ordering = generateOrderingQueryParams(orderBy, orderAsc);
const queryParams = mergeOptions(
{
page,
pageSize,
ordering,
piece_id: pieceId
},
filterBy
);
return requests.get('editions_list', queryParams);
}
};
export default EditionListFetcher;