mirror of
https://github.com/ascribe/onion.git
synced 2024-12-23 01:39:36 +01:00
30 lines
778 B
JavaScript
30 lines
778 B
JavaScript
import fetch from 'isomorphic-fetch';
|
|
|
|
import AppConstants from '../constants/application_constants';
|
|
import FetchApiUtils from '../utils/fetch_api_utils';
|
|
|
|
let PieceListFetcher = {
|
|
/**
|
|
* Fetches a list of pieces from the API.
|
|
* Can be called with all supplied queryparams the API.
|
|
*
|
|
*
|
|
*/
|
|
fetch(page, pageSize, search, ordering) {
|
|
|
|
let params = FetchApiUtils.argsToQueryParams({
|
|
page,
|
|
pageSize,
|
|
search,
|
|
ordering
|
|
});
|
|
|
|
return fetch(AppConstants.baseUrl + 'pieces/' + params, {
|
|
headers: {
|
|
'Authorization': 'Basic ' + AppConstants.debugCredentialBase64
|
|
}
|
|
}).then((res) => res.json());
|
|
}
|
|
};
|
|
|
|
export default PieceListFetcher; |