mapping
7 years ago
angular-chosen.directive.js
7 years ago
attributes.service.js
7 years ago
autodetect.directive.js
7 years ago
cascade.directive.js
7 years ago
contenteditable.directive.js
7 years ago
currency.service.js
7 years ago
droppable.directive.js
7 years ago
export.service.js
7 years ago
focusMeWhenEnabled.directive.js
7 years ago
googleCategoriesService.js
7 years ago
main.controller.js
7 years ago
styledInput.directive.js
7 years ago
template.service.js
7 years ago
tipsy.directive.js
7 years ago
wpHttp.service.js
7 years ago
wpHttp.service.js
31 lines
| 1 | GoogleMerchants.factory('wpHttp', ['$http', '$q', '$log', 'BACKEND', 'NONCE', function($http, $q, $log, BACKEND, NONCE){ |
| 2 | |
| 3 | var post = function(url, data) { |
| 4 | |
| 5 | var deferred = $q.defer(); |
| 6 | $http.post(BACKEND + url + '&security=' + NONCE, data).then(function(response){ |
| 7 | deferred.resolve(response.data); |
| 8 | }, function(msg, code){ |
| 9 | deferred.reject(msg,code); |
| 10 | }); |
| 11 | |
| 12 | return deferred.promise; |
| 13 | }; |
| 14 | |
| 15 | var get = function(url) { |
| 16 | |
| 17 | var deferred = $q.defer(); |
| 18 | $http.get(BACKEND + url + '&security=' + NONCE).then(function(response){ |
| 19 | deferred.resolve(response.data); |
| 20 | }, function(msg, code){ |
| 21 | deferred.reject(msg,code); |
| 22 | }); |
| 23 | |
| 24 | return deferred.promise; |
| 25 | }; |
| 26 | |
| 27 | return { |
| 28 | post: post, |
| 29 | get: get |
| 30 | } |
| 31 | }]); |