- },
- function (error) {
- /* eslint-disable no-console */
- console.log("Get REST API error: "
- + error.statusText);
- /* eslint-enable no-console */
- cb(null);
- });
- };
- svc.postRestAPI = function (path, json, cb) {
- return $http({
- method: 'POST',
- url: appContext + path,
- headers: {
- 'Content-Type': "application/json",
- 'Accept': "application/json"
- },
- data: json
- }).then(
- function (response) {
- if (response.status == 200
- || response.status == 201) {
- cb(response.data);
- } else {
- /* eslint-disable no-console */
- console.log("Post REST API error: "
- + response.statusText);
- /* eslint-enable no-console */
- cb(null);
- }
- },
- function (error) {
- /* eslint-disable no-console */
- console.log("Post REST API error: "
- + error.statusText);
- /* eslint-enable no-console */
- cb(null);
- });
- };
- svc.deleteRestAPI = function (path, json) {
- return $http({
- method: 'DELETE',
- url: appContext + path,
- headers: {
- 'Content-Type': "application/json",
- 'Accept': "application/json"
- },
- data: json
- }).then(
- function (response) {
- if (response.status !== 200) {
- /* eslint-disable no-console */
- console.log("Delete REST API error: "
- + response.statusText);
- /* eslint-enable no-console */
- }
- },
- function (error) {
- /* eslint-disable no-console */
- console.log("Delete REST API error: "
- + error.statusText);
- /* eslint-enable no-console */
- });
- };
- return svc;
- }]);
+ }).then(
+ function(response) {
+ if (response.status == 200) {
+ cb(response.data);
+ } else {
+ /* eslint-disable no-console */
+ console.log("Get REST API error: "
+ + response.statusText);
+ /* eslint-enable no-console */
+ cb(null);
+ }
+ },
+ function(error) {
+ /* eslint-disable no-console */
+ console.log("Get REST API error: "
+ + error.statusText);
+ /* eslint-enable no-console */
+ cb(null);
+ });
+ };
+ svc.postRestAPI = function(path, json, cb) {
+ return $http({
+ method : 'POST',
+ url : appContext + path,
+ headers : {
+ 'Content-Type' : "application/json",
+ 'Accept' : "application/json"
+ },
+ data : json
+ }).then(
+ function(response) {
+ if (response.status == 200
+ || response.status == 201) {
+ cb(response.data);
+ } else {
+ /* eslint-disable no-console */
+ console.log("Post REST API error: "
+ + response.statusText);
+ /* eslint-enable no-console */
+ cb(null);
+ }
+ },
+ function(error) {
+ /* eslint-disable no-console */
+ console.log("Post REST API error: "
+ + error.statusText);
+ /* eslint-enable no-console */
+ cb(null);
+ });
+ };
+ svc.deleteRestAPI = function(path, json, cb) {
+ return $http({
+ method : 'DELETE',
+ url : appContext + path,
+ headers : {
+ 'Content-Type' : "application/json",
+ 'Accept' : "application/json"
+ },
+ data : json
+ }).then(
+ function(response) {
+ if (response.status !== 200) {
+ /* eslint-disable no-console */
+ console.log("Delete REST API error: "
+ + response.statusText);
+ /* eslint-enable no-console */
+ cb(null);
+ }
+ cb(response.data);
+ },
+ function(error) {
+ /* eslint-disable no-console */
+ console.log("Delete REST API error: "
+ + error.statusText);
+ /* eslint-enable no-console */
+ cb(null);
+ });
+ };
+ return svc;
+ } ]);