mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 17:45:10 +01:00
d23331d9b9
ReactS3FineUploader used to check the current url’s query params to determine which method it should use to upload, but this decision means the component is tightly coupled with react-router and history.js. A major pain point is having to propagate the location prop all the way down to this component even when it’s not necessary. Now, ReactS3FineUploader’s parent elements can either parse the current query params themselves or, if they have a location from react-router, simply use the location. Added a few utils to help parse url params.
30 lines
723 B
JavaScript
30 lines
723 B
JavaScript
'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.
|
|
*/
|
|
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;
|