Skip to content

Commit

Permalink
[Release] 0.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kiaking committed Nov 18, 2019
1 parent 395ab97 commit 0ae8245
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 29 deletions.
33 changes: 24 additions & 9 deletions dist/vuex-orm-axios.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,17 @@ var Response = /** @class */ (function () {
*/
Response.prototype.save = function () {
return __awaiter(this, void 0, void 0, function () {
var _a;
var data, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
data = this.getDataFromResponse();
if (!this.validateData(data)) {
console.warn('[Vuex ORM Axios] The response data could not be saved to the store because it\'s not an object or an array. You might want to use `dataTransformer` option to handle non-array/object response before saving it to the store.');
return [2 /*return*/];
}
_a = this;
return [4 /*yield*/, this.model.insertOrUpdate({
data: this.getDataFromResponse()
})];
return [4 /*yield*/, this.model.insertOrUpdate({ data: data })];
case 1:
_a.entities = _b.sent();
this.isSaved = true;
Expand Down Expand Up @@ -134,6 +137,12 @@ var Response = /** @class */ (function () {
}
return this.response.data;
};
/**
* Validate if the given data is insertable to Vuex ORM.
*/
Response.prototype.validateData = function (data) {
return data !== null && typeof data === 'object';
};
return Response;
}());

Expand Down Expand Up @@ -263,18 +272,24 @@ var Request = /** @class */ (function () {
*/
Request.prototype.createResponse = function (axiosResponse, config) {
return __awaiter(this, void 0, void 0, function () {
var response;
return __generator(this, function (_a) {
switch (_a.label) {
var response, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
response = new Response(this.model, config, axiosResponse);
if (!(config.delete !== undefined)) return [3 /*break*/, 2];
return [4 /*yield*/, response.delete()];
case 1:
_a.sent();
_b.sent();
return [2 /*return*/, response];
case 2:
config.save && response.save();
_a = config.save;
if (!_a) return [3 /*break*/, 4];
return [4 /*yield*/, response.save()];
case 3:
_a = (_b.sent());
_b.label = 4;
case 4:
return [2 /*return*/, response];
}
});
Expand Down
33 changes: 24 additions & 9 deletions dist/vuex-orm-axios.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,17 @@ var Response = /** @class */ (function () {
*/
Response.prototype.save = function () {
return __awaiter(this, void 0, void 0, function () {
var _a;
var data, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
data = this.getDataFromResponse();
if (!this.validateData(data)) {
console.warn('[Vuex ORM Axios] The response data could not be saved to the store because it\'s not an object or an array. You might want to use `dataTransformer` option to handle non-array/object response before saving it to the store.');
return [2 /*return*/];
}
_a = this;
return [4 /*yield*/, this.model.insertOrUpdate({
data: this.getDataFromResponse()
})];
return [4 /*yield*/, this.model.insertOrUpdate({ data: data })];
case 1:
_a.entities = _b.sent();
this.isSaved = true;
Expand Down Expand Up @@ -132,6 +135,12 @@ var Response = /** @class */ (function () {
}
return this.response.data;
};
/**
* Validate if the given data is insertable to Vuex ORM.
*/
Response.prototype.validateData = function (data) {
return data !== null && typeof data === 'object';
};
return Response;
}());

Expand Down Expand Up @@ -261,18 +270,24 @@ var Request = /** @class */ (function () {
*/
Request.prototype.createResponse = function (axiosResponse, config) {
return __awaiter(this, void 0, void 0, function () {
var response;
return __generator(this, function (_a) {
switch (_a.label) {
var response, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
response = new Response(this.model, config, axiosResponse);
if (!(config.delete !== undefined)) return [3 /*break*/, 2];
return [4 /*yield*/, response.delete()];
case 1:
_a.sent();
_b.sent();
return [2 /*return*/, response];
case 2:
config.save && response.save();
_a = config.save;
if (!_a) return [3 /*break*/, 4];
return [4 /*yield*/, response.save()];
case 3:
_a = (_b.sent());
_b.label = 4;
case 4:
return [2 /*return*/, response];
}
});
Expand Down
33 changes: 24 additions & 9 deletions dist/vuex-orm-axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,17 @@
*/
Response.prototype.save = function () {
return __awaiter(this, void 0, void 0, function () {
var _a;
var data, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
data = this.getDataFromResponse();
if (!this.validateData(data)) {
console.warn('[Vuex ORM Axios] The response data could not be saved to the store because it\'s not an object or an array. You might want to use `dataTransformer` option to handle non-array/object response before saving it to the store.');
return [2 /*return*/];
}
_a = this;
return [4 /*yield*/, this.model.insertOrUpdate({
data: this.getDataFromResponse()
})];
return [4 /*yield*/, this.model.insertOrUpdate({ data: data })];
case 1:
_a.entities = _b.sent();
this.isSaved = true;
Expand Down Expand Up @@ -138,6 +141,12 @@
}
return this.response.data;
};
/**
* Validate if the given data is insertable to Vuex ORM.
*/
Response.prototype.validateData = function (data) {
return data !== null && typeof data === 'object';
};
return Response;
}());

Expand Down Expand Up @@ -267,18 +276,24 @@
*/
Request.prototype.createResponse = function (axiosResponse, config) {
return __awaiter(this, void 0, void 0, function () {
var response;
return __generator(this, function (_a) {
switch (_a.label) {
var response, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
response = new Response(this.model, config, axiosResponse);
if (!(config.delete !== undefined)) return [3 /*break*/, 2];
return [4 /*yield*/, response.delete()];
case 1:
_a.sent();
_b.sent();
return [2 /*return*/, response];
case 2:
config.save && response.save();
_a = config.save;
if (!_a) return [3 /*break*/, 4];
return [4 /*yield*/, response.save()];
case 3:
_a = (_b.sent());
_b.label = 4;
case 4:
return [2 /*return*/, response];
}
});
Expand Down
2 changes: 1 addition & 1 deletion dist/vuex-orm-axios.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vuex-orm/plugin-axios",
"version": "0.9.0",
"version": "0.9.1",
"description": "Vuex ORM plugin for adding smooth integration with axios.",
"main": "dist/vuex-orm-axios.common.js",
"module": "dist/vuex-orm-axios.esm.js",
Expand Down

0 comments on commit 0ae8245

Please sign in to comment.