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

30 lines
731 B
JavaScript
Raw Normal View History

'use strict';
import requests from '../utils/requests';
import { mergeOptions } from '../utils/general_utils';
import { generateOrderingQueryParams } from '../utils/url_utils';
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);
2016-01-18 10:53:01 +01:00
const queryParams = mergeOptions(
{
page,
pageSize,
ordering,
piece_id: pieceId
},
filterBy
);
return requests.get('editions_list', queryParams);
}
};
2015-06-01 17:43:38 +02:00
export default EditionListFetcher;