Commit 354c9b0c authored by Samir Sadyhov's avatar Samir Sadyhov 🤔

update appAPI (фильтры реестра)

parent 6bc40041
......@@ -638,6 +638,15 @@ this.appAPI = {
});
},
getRegistryListWithFilters: async function() {
return new Promise(async resolve => {
rest.synergyGet(`api/registry/listWithFilters?locale=${AS.OPTIONS.locale}`, resolve, err => {
console.log(`ERROR [ getRegistryListWithFilters ]: ${JSON.stringify(err)}`);
resolve(null);
});
});
},
getRegistryInfo: async function(registryCode) {
return new Promise(async resolve => {
rest.synergyGet(`api/registry/info?code=${registryCode}&locale=${AS.OPTIONS.locale}`, resolve, err => {
......@@ -924,5 +933,53 @@ this.appAPI = {
}
});
}
},
filter: {
info: async function(filterID){
return new Promise(async resolve => {
rest.synergyGet(`api/registry/filter_info?locale=${AS.OPTIONS.locale}&filterID=${filterID}`, resolve, err => {
console.log(`ERROR [ filterInfo ]: ${JSON.stringify(err)}`);
resolve(null);
});
});
},
save: async function(body){
return new Promise(async resolve => {
try {
const {login, password} = Cons.creds;
const url = `../Synergy/rest/api/registry/filters/users/save?locale=${AS.OPTIONS.locale}`;
const headers = new Headers();
headers.append("Authorization", "Basic " + btoa(unescape(encodeURIComponent(`${login}:${password}`))));
headers.append("Content-Type", "application/json; charset=UTF-8");
const response = await fetch(url, {method: 'POST', headers, body: JSON.stringify(body)});
resolve(response.json());
} catch (err) {
console.log(`ERROR [ saveUsersFilter ]: ${err.message}`);
resolve({
errorCode: 666,
errorMessage: err.message
});
}
});
},
delete: async function(filterID){
return new Promise(async resolve => {
try {
const {login, password} = Cons.creds;
const url = `../Synergy/rest/api/registry/filters/users/delete?locale=${AS.OPTIONS.locale}&filterID=${filterID}`;
const headers = new Headers();
headers.append("Authorization", "Basic " + btoa(unescape(encodeURIComponent(`${login}:${password}`))));
headers.append("Content-Type", "application/json; charset=UTF-8");
const response = await fetch(url, {method: 'POST', headers});
resolve(response.text());
} catch (err) {
console.log(`ERROR [ deleteUsersFilter ]: ${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