Backend: handle response on the frontend (#839)

This commit is contained in:
vignesh-reddy
2019-12-12 02:48:03 -06:00
committed by Alexander Zobnin
parent 0233ae7046
commit 0bb2f7c7d8

View File

@@ -40,26 +40,10 @@ export class ZabbixAPIConnector {
//////////////////////////
request(method, params) {
this.tsdbRequest(method, params).then(response => {
return this.tsdbRequest(method, params).then(response => {
const result = this.handleTsdbResponse(response);
console.log(result);
});
return this.zabbixAPICore.request(this.url, method, params, this.requestOptions, this.auth)
.catch(error => {
if (isNotAuthorized(error.data)) {
// Handle auth errors
this.loginErrorCount++;
if (this.loginErrorCount > this.maxLoginAttempts) {
this.loginErrorCount = 0;
return null;
} else {
return this.loginOnce()
.then(() => this.request(method, params));
}
} else {
return Promise.reject(error);
}
return result;
});
}