wazuh-kibana-app/public/objects/testConnection.js

41 lines
1.4 KiB
JavaScript
Raw Normal View History

2016-08-11 12:14:42 +00:00
require('ui/modules').get('app/wazuh', [])
.service('testConnection', function ($q, $http) {
return {
test: function () {
var defered = $q.defer();
var promise = defered.promise;
$http.get("/api/wazuh-api/test")
.success(function (data) {
if (data.error) {
defered.reject(data);
} else {
defered.resolve(data);
}
})
.error(function (data) {
defered.reject(data);
})
2016-10-25 19:03:21 +00:00
return promise;
},
test_tmp: function (data) {
var defered = $q.defer();
var promise = defered.promise;
$http.post("/api/wazuh-api/test", data)
.success(function (data) {
if (data.error) {
defered.reject(data);
} else {
defered.resolve(data);
}
})
.error(function (data) {
defered.reject(data);
})
2016-08-11 12:14:42 +00:00
return promise;
}
};
});