summaryrefslogtreecommitdiff
path: root/client/js
diff options
context:
space:
mode:
authormanzerbredes <loic.guegan_secondary@yahoo.fr>2016-03-06 14:42:50 +0100
committermanzerbredes <loic.guegan_secondary@yahoo.fr>2016-03-06 14:42:50 +0100
commit3454c71f0523bd6957e10873d0b95bc191b2f283 (patch)
treeab7f7a56b6999cef1195364df66f060d2dc5a834 /client/js
parentdad2e1de334b6c8d9e579a0f75272d8661ed2aa3 (diff)
Test request
Diffstat (limited to 'client/js')
-rw-r--r--client/js/controllers/home/home.js5
-rw-r--r--client/js/services/Image.js14
2 files changed, 13 insertions, 6 deletions
diff --git a/client/js/controllers/home/home.js b/client/js/controllers/home/home.js
index f84f625..18133fa 100644
--- a/client/js/controllers/home/home.js
+++ b/client/js/controllers/home/home.js
@@ -3,7 +3,7 @@
*
* @param {$scope} $scope The $scope service from angular
*/
-mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', 'Loading','Identity', function ($scope, Compute, $rootScope, Loading, Identity)
+mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', 'Loading','Identity', 'Image', function ($scope, Compute, $rootScope, Loading, Identity, Image)
{
var callMeAfterPullData=function(data){
@@ -17,7 +17,8 @@ mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', 'Loading','I
Compute.pullData(callMeAfterPullData);
}
-
+
+ Image.getImages(function(){});
$scope.raiseShowMachineDetailsEvent=function(id){
diff --git a/client/js/services/Image.js b/client/js/services/Image.js
index 23b33a8..eccd4af 100644
--- a/client/js/services/Image.js
+++ b/client/js/services/Image.js
@@ -4,16 +4,22 @@ mainApp.factory('Image',[ '$http', 'Identity', function($http, Identity){
var parseUploadImageAnswer=function(response, failedToSendRequest){
-
+ console.log(response.data.Images[0])
};
var getImages=function(callback){
var result=$http.post('../server/index.php',
- $.param({"token" : Identity.profile.token, "task" : "Image"}));
+ $.param({"token" : Identity.getToken(), "task" : "image", 'action':'listImage'}));
+
+ // Wait and handle the response
+ result.then(function (response){
+ callback(parseUploadImageAnswer(response, false));
+ },function(response){
+ callback(parseUploadImageAnswer(response, true));
+ });
-
};
@@ -21,7 +27,7 @@ mainApp.factory('Image',[ '$http', 'Identity', function($http, Identity){
// Return services objects
return {
- uploadImage: uploadImage
+ getImages:getImages
};