2 // Enable the modal to be opened from anywhere
3 // If we're working with an existing batch, set the ID so the
5 window.openBatchModal = function (id, backend) {
6 var idEl = document.getElementById('ill-batch-details');
7 idEl.dataset.backend = backend;
9 idEl.dataset.batchId = id;
11 $('#ill-batch-modal').modal({ show: true });
14 // Make a batch API call, returning the resulting promise
15 window.doBatchApiRequest = function (url, options) {
16 var batchListApi = '/api/v1/illbatches';
17 var fullUrl = batchListApi + (url ? url : '');
18 return doApiRequest(fullUrl, options);
21 // Make a "create local ILL submission" call
22 window.doCreateSubmission = function (body, options) {
23 options = Object.assign(
27 'Content-Type': 'application/json'
30 body: JSON.stringify(body)
34 '/api/v1/ill/requests',
39 // Make an API call, returning the resulting promise
40 window.doApiRequest = function (url, options) {
41 return fetch(url, options);
44 // Display an API error
45 window.handleApiError = function (error) {