Debug
This commit is contained in:
parent
5b5f526aa0
commit
7a587387aa
3 changed files with 43 additions and 9 deletions
|
@ -4,9 +4,9 @@ mainApp.factory('Image', ['$http', 'Identity', function ($http, Identity) {
|
|||
// Data object
|
||||
var data = {};
|
||||
data.images = null; // Images
|
||||
data.axioms={};
|
||||
data.axioms.protected=[true,false];
|
||||
data.axioms.visibility=["public", "private"];
|
||||
data.axioms = {};
|
||||
data.axioms.protected = [true, false];
|
||||
data.axioms.visibility = ["public", "private"];
|
||||
/**
|
||||
* Parse uploadImage anwser
|
||||
* @param {type} response
|
||||
|
@ -55,6 +55,29 @@ mainApp.factory('Image', ['$http', 'Identity', function ($http, Identity) {
|
|||
|
||||
};
|
||||
|
||||
/**
|
||||
* Update image
|
||||
* @param {type} image
|
||||
* @param {type} callback
|
||||
* @returns {undefined}
|
||||
*/
|
||||
var updateImage = function (image, callback) {
|
||||
|
||||
var result = $http.post('../server/index.php',
|
||||
$.param({"token": Identity.getToken(), "task": "image", 'action': 'updateImage', 'id': image.id, 'opt': image}));
|
||||
|
||||
// Wait and handle the response
|
||||
result.then(function (response) {
|
||||
callback();
|
||||
}, function (response) {
|
||||
alert(response)
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Upload an image
|
||||
* @param {type} fileToUpload
|
||||
|
@ -108,6 +131,7 @@ mainApp.factory('Image', ['$http', 'Identity', function ($http, Identity) {
|
|||
// Return services objects
|
||||
return {
|
||||
getImages: getImages,
|
||||
updateImage: updateImage,
|
||||
getData: getData,
|
||||
uploadImage: uploadImage
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue