-
-
Save anonymous/75abd43e12bb3efbf5950ab73f51c5b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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