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

update appAPI.js

parent 1438cb26
......@@ -245,37 +245,52 @@ this.appAPI = {
getAsfDataUUID: async function(documentID) {
return new Promise(async resolve => {
AS.FORMS.ApiUtils.simpleAsyncGet(`rest/api/formPlayer/getAsfDataUUID?documentID=${documentID}`,
resolve, 'text', null,
err => {
console.log(`ERROR [ getAsfDataUUID ]: ${JSON.stringify(err)}`);
resolve(null);
}
);
try {
const {login, password} = Cons.creds;
const auth = "Basic " + btoa(unescape(encodeURIComponent(`${login}:${password}`)));
const url = `../Synergy/rest/api/formPlayer/getAsfDataUUID?documentID=${documentID}`;
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) {
return new Promise(async resolve => {
AS.FORMS.ApiUtils.simpleAsyncGet(`rest/api/formPlayer/documentIdentifier?dataUUID=${dataUUID}`,
resolve, 'text', null,
err => {
console.log(`ERROR [ getDocumentIdentifier ]: ${JSON.stringify(err)}`);
resolve(null);
}
);
try {
const {login, password} = Cons.creds;
const auth = "Basic " + btoa(unescape(encodeURIComponent(`${login}:${password}`)));
const url = `../Synergy/rest/api/formPlayer/documentIdentifier?dataUUID=${dataUUID}`;
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) {
return new Promise(async resolve => {
AS.FORMS.ApiUtils.simpleAsyncGet(`rest/api/formPlayer/getDocMeaningContent?asfDataUUID=${asfDataUUID}`,
resolve, 'text', null,
err => {
console.log(`ERROR [ getDocMeaningContent ]: ${JSON.stringify(err)}`);
resolve(null);
}
);
try {
const {login, password} = Cons.creds;
const auth = "Basic " + btoa(unescape(encodeURIComponent(`${login}:${password}`)));
const url = `../Synergy/rest/api/formPlayer/getDocMeaningContent?asfDataUUID=${asfDataUUID}`;
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