Commit aa83a1a8 authored by Samir Sadyhov's avatar Samir Sadyhov 🤔

update appAPI.js

parent 1438cb26
...@@ -245,37 +245,52 @@ this.appAPI = { ...@@ -245,37 +245,52 @@ this.appAPI = {
getAsfDataUUID: async function(documentID) { getAsfDataUUID: async function(documentID) {
return new Promise(async resolve => { return new Promise(async resolve => {
AS.FORMS.ApiUtils.simpleAsyncGet(`rest/api/formPlayer/getAsfDataUUID?documentID=${documentID}`, try {
resolve, 'text', null, const {login, password} = Cons.creds;
err => { const auth = "Basic " + btoa(unescape(encodeURIComponent(`${login}:${password}`)));
console.log(`ERROR [ getAsfDataUUID ]: ${JSON.stringify(err)}`); const url = `../Synergy/rest/api/formPlayer/getAsfDataUUID?documentID=${documentID}`;
resolve(null); const response = await fetch(url, {method: 'GET', headers: {"Authorization": auth}});
}
); if(!response.ok) throw new Error(await response.text());
resolve(response.text());
} catch (err) {
console.log(`ERROR [ getAsfDataUUID ]: ${err.message}`);
resolve(null);
}
}); });
}, },
getDocumentIdentifier: async function(dataUUID) { getDocumentIdentifier: async function(dataUUID) {
return new Promise(async resolve => { return new Promise(async resolve => {
AS.FORMS.ApiUtils.simpleAsyncGet(`rest/api/formPlayer/documentIdentifier?dataUUID=${dataUUID}`, try {
resolve, 'text', null, const {login, password} = Cons.creds;
err => { const auth = "Basic " + btoa(unescape(encodeURIComponent(`${login}:${password}`)));
console.log(`ERROR [ getDocumentIdentifier ]: ${JSON.stringify(err)}`); const url = `../Synergy/rest/api/formPlayer/documentIdentifier?dataUUID=${dataUUID}`;
resolve(null); const response = await fetch(url, {method: 'GET', headers: {"Authorization": auth}});
}
); if(!response.ok) throw new Error(await response.text());
resolve(response.text());
} catch (err) {
console.log(`ERROR [ getDocumentIdentifier ]: ${err.message}`);
resolve(null);
}
}); });
}, },
getDocMeaningContent: async function(asfDataUUID) { getDocMeaningContent: async function(asfDataUUID) {
return new Promise(async resolve => { return new Promise(async resolve => {
AS.FORMS.ApiUtils.simpleAsyncGet(`rest/api/formPlayer/getDocMeaningContent?asfDataUUID=${asfDataUUID}`, try {
resolve, 'text', null, const {login, password} = Cons.creds;
err => { const auth = "Basic " + btoa(unescape(encodeURIComponent(`${login}:${password}`)));
console.log(`ERROR [ getDocMeaningContent ]: ${JSON.stringify(err)}`); const url = `../Synergy/rest/api/formPlayer/getDocMeaningContent?asfDataUUID=${asfDataUUID}`;
resolve(null); const response = await fetch(url, {method: 'GET', headers: {"Authorization": auth}});
}
); if(!response.ok) throw new Error(await response.text());
resolve(response.text());
} catch (err) {
console.log(`ERROR [ getDocMeaningContent ]: ${err.message}`);
resolve(null);
}
}); });
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment