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

31 lines
724 B
JavaScript
Raw Normal View History

'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.
*/
2016-01-18 10:53:01 +01:00
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 }
});
}
};
2015-06-01 17:43:38 +02:00
export default EditionListFetcher;