- fixed displaying tables;

- fixed uploading signed pdf for application;
- added downloading modullistica archive;
- added basic table related validator;
This commit is contained in:
Vitalii Kiiko
2024-10-13 12:20:47 +02:00
parent 2bedcee172
commit cd54246313
16 changed files with 194 additions and 56 deletions

View File

@@ -31,4 +31,8 @@ export default class BandoService {
static updateBandoStatus = (id, callback, errCallback, queryParams) => {
NetworkService.put(`${API_BASE_URL}/call/${id}/status`, {}, callback, errCallback, queryParams);
};
static getBandoPdf = (id, callback, errCallback) => {
NetworkService.getBlob(`${API_BASE_URL}/call/${id}/documents/zip`, callback, errCallback);
};
}

View File

@@ -389,6 +389,46 @@ export class NetworkService {
};
static getBlob = (url, callback, errorCallback, queryParams) => {
if (queryParams) {
url += '?'
for (let i = 0; i < queryParams.length; i++) {
if (queryParams[i] && this.isNotBlank(queryParams[i][0]) && this.isNotBlank(queryParams[i][1])) {
let param = queryParams[i][0] + '=' + queryParams[i][1]
if (i !== queryParams.length - 1)
param += '&'
url += param;
}
}
if (url.charAt(url.length) === '&')
url = url.substring(0, url.length - 1);
}
fetch(url, {
method: 'GET',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + storeGet.main.getToken(),
},
})
.then(async response => {
let status = response.status;
return { response: await response.blob(), status: status }
})
.then(data => {
if (data.status >= 400 && data.status <= 599)
errorCallback(data.response)
else
callback(data.response)
})
.catch(err => errorCallback(err));
};
static promiseGet = async (url, queryParams = null) => {
const response = await fetch(url, {
method: 'GET',