Skip to content

Instantly share code, notes, and snippets.

/po_service.js Secret

Created June 15, 2016 19:00
Show Gist options
  • Save anonymous/75abd43e12bb3efbf5950ab73f51c5b9 to your computer and use it in GitHub Desktop.
Save anonymous/75abd43e12bb3efbf5950ab73f51c5b9 to your computer and use it in GitHub Desktop.
'use strict';
App.factory('PoService', ['$http', '$q', function ($http, $q) {
return {
fetchAllOrders: function () {
return $http.get('http://localhost:8080/api/po/all')
.then(
function (response) {
return response.data;
},
function (errResponse) {
console.error('Error while fetching production orders');
return $q.reject(errResponse);
}
);
},
createOrder: function (item) {
return $http.post('http://localhost:8080/api/po/add', item)
.then(
function (res) {
return res.data;
},
function (errRes) {
console.error('Error while adding production order');
return $q.reject(errRes);
}
);
}
};
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment