mirror of
https://github.com/ascribe/onion.git
synced 2024-12-23 01:39:36 +01:00
27 lines
752 B
JavaScript
27 lines
752 B
JavaScript
'use strict';
|
|
|
|
import { generateOrderingQueryParams } from '../utils/fetch_api_utils';
|
|
import requests from '../utils/requests';
|
|
|
|
|
|
let PieceListFetcher = {
|
|
/**
|
|
* Fetches a list of pieces from the API.
|
|
* Can be called with all supplied queryparams the API.
|
|
*/
|
|
fetch(page, pageSize, search, orderBy, orderAsc) {
|
|
let ordering = generateOrderingQueryParams(orderBy, orderAsc);
|
|
return requests.get('pieces_list', { page, pageSize, search, ordering });
|
|
},
|
|
|
|
fetchRequestActions() {
|
|
return requests.get('pieces_list_request_actions');
|
|
},
|
|
|
|
fetchFirstEditionForPiece(pieceId) {
|
|
return requests.get('piece_first_edition_id', {'piece_id': pieceId});
|
|
}
|
|
};
|
|
|
|
export default PieceListFetcher;
|