diff options
| author | Loic GUEGAN <loic@Manzerbredes.home> | 2016-04-17 18:50:05 +0200 |
|---|---|---|
| committer | Loic GUEGAN <loic@Manzerbredes.home> | 2016-04-17 18:50:05 +0200 |
| commit | bb1598713c0b6bbe39209c14681c759ab9907edc (patch) | |
| tree | 1483ca31662258cfb570ec736e85d63ae48627cc /client/js/services/Network.js | |
| parent | 968eda48cc8f3af2214e347e83937086c5e93ad4 (diff) | |
Clean code, add comment etc..
Diffstat (limited to 'client/js/services/Network.js')
| -rw-r--r-- | client/js/services/Network.js | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/client/js/services/Network.js b/client/js/services/Network.js index bd2a24f..a0cd5a4 100644 --- a/client/js/services/Network.js +++ b/client/js/services/Network.js @@ -1,27 +1,29 @@ -mainApp.factory('Network',[ '$http', 'Identity', function($http, Identity){ - - var data={}; - data.networks=null; - -var ListId=function(fileToUpload, callback) { - - - var result=$http.post('../server/index.php', - $.param({"token" : Identity.getToken(), "task" : "network", 'action':'list_network_ids'})); - - // Wait and handle the response - result.then(function (response){ - callback(parseUploadImageAnswer(response, false)); - },function(response){ - callback(parseUploadImageAnswer(response, true)); - }); - - console.log(result) - - } - - -}]); +mainApp.factory('Network', ['$http', 'Identity', function ($http, Identity) { + + // Data object + var data = {}; + data.networks = null; // Networks + + /** + * ListId + * @param {type} fileToUpload + * @param {type} callback + * @returns {undefined} + */ + var ListId = function (fileToUpload, callback) { + var result = $http.post('../server/index.php', + $.param({"token": Identity.getToken(), "task": "network", 'action': 'list_network_ids'})); + + // Wait and handle the response + result.then(function (response) { + callback(parseUploadImageAnswer(response, false)); + }, function (response) { + callback(parseUploadImageAnswer(response, true)); + }); + }; + + + }]); |
