Clean code

This commit is contained in:
manzerbredes 2016-02-29 08:54:04 +01:00
parent 6a67f6ba9d
commit 3656654077
2 changed files with 37 additions and 19 deletions

View file

@ -2,11 +2,12 @@
mainApp.factory('Compute',[ '$http', 'Identity', function($http, Identity){
// Create data
var data={};
data.machines={};
// Parser
var parseGetMachinesAnswer=function(response, failedToSendRequest){
@ -15,9 +16,16 @@ mainApp.factory('Compute',[ '$http', 'Identity', function($http, Identity){
// Get Machine
var getMachines=function(callback){
var params={
"token" : Identity.getToken(),
"task" : "compute",
"action":"getServer",
"serverId":"69d5bcc4-2fab-4634-b0d2-f455fee5b7bd"
};
var result=$http.post('../server/index.php',
$.param({"token" : Identity.getToken(), "task" : "compute", "action":"getServer", serverId:"69d5bcc4-2fab-4634-b0d2-f455fee5b7bd"}));
$.param(params));
// Wait and handle the response
result.then(function (response){
@ -25,7 +33,7 @@ mainApp.factory('Compute',[ '$http', 'Identity', function($http, Identity){
callback(parseGetMachinesAnswer(response, false));
},function(response){
alert(response.status);
callback(parseGetMachinesAnswer(response, true));
callback(parseGetMachinesAnswer(response, true));
});