1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00
onion/js/fetchers/edition_list_fetcher.js

31 lines
724 B
JavaScript

'use strict';
import request from '../utils/request';
import { safeMerge } 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 query = safeMerge(
{
page,
pageSize,
ordering
},
filterBy
);
return request('editions_list', {
query,
urlTemplateSpec: { pieceId }
});
}
};
export default EditionListFetcher;