rheactor-web-app
Advanced tools
Comparing version 4.1.0 to 4.1.1
@@ -40,2 +40,9 @@ 'use strict'; | ||
var handleErrorResponses = function handleErrorResponses(response) { | ||
if (response.status >= 400) { | ||
throw response; | ||
} | ||
return response; | ||
}; | ||
var GenericAPIService = function () { | ||
@@ -97,2 +104,4 @@ /** | ||
return this.$http.post(endpoint.toString(), model, config).then(function (response) { | ||
return handleErrorResponses(response); | ||
}).then(function (response) { | ||
if (response.data) { | ||
@@ -138,2 +147,4 @@ var _model = _this.apiService.createModelInstance(response.data); | ||
return this.$http.post(endpoint.toString(), _query, config).then(function (response) { | ||
return handleErrorResponses(response); | ||
}).then(function (response) { | ||
if (!response.data) return null; | ||
@@ -168,2 +179,4 @@ var model = _this2.apiService.createModelInstance(response.data); | ||
return this.$http.get(endpoint.toString(), config).then(function (response) { | ||
return handleErrorResponses(response); | ||
}).then(function (response) { | ||
if (response.data) { | ||
@@ -206,2 +219,4 @@ var model = _this3.apiService.createModelInstance(response.data); | ||
return this.$http.post(endpoint.toString(), query, config).then(function (response) { | ||
return handleErrorResponses(response); | ||
}).then(function (response) { | ||
if (response.data) { | ||
@@ -242,3 +257,5 @@ var model = _this4.apiService.createModelInstance(response.data); | ||
(0, _rheactorModels.MaybeJsonWebTokenType)(token, ['GenericAPIService.navigateList', 'token:?JsonWebToken']); | ||
return this.list(_jsonld.JSONLD.getRelLink(dir, list), {}, token); | ||
return this.list(_jsonld.JSONLD.getRelLink(dir, list), {}, token).then(function (response) { | ||
return handleErrorResponses(response); | ||
}); | ||
} | ||
@@ -265,3 +282,5 @@ | ||
}; | ||
return this.$http.put(endpoint.toString(), data, config).catch(function (err) { | ||
return this.$http.put(endpoint.toString(), data, config).then(function (response) { | ||
return handleErrorResponses(response); | ||
}).catch(function (err) { | ||
return err.status; | ||
@@ -291,3 +310,5 @@ }, function (err) { | ||
}; | ||
return this.$http.delete(endpoint.toString(), config).catch(function (err) { | ||
return this.$http.delete(endpoint.toString(), config).then(function (response) { | ||
return handleErrorResponses(response); | ||
}).catch(function (err) { | ||
return err.status; | ||
@@ -294,0 +315,0 @@ }, function (err) { |
{ | ||
"name": "rheactor-web-app", | ||
"description": "Contains the building blocks for a web application", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"scripts": { | ||
@@ -6,0 +6,0 @@ "test": "NODE_ENV=testing mocha --compilers js:babel-register --reporter=dot --timeout=1350 test/\\*\\*/\\*.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
220607
3303