Skip to content

Commit

Permalink
[Release] 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kiaking committed Oct 31, 2019
1 parent 92824c6 commit 2f0750b
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 43 deletions.
35 changes: 22 additions & 13 deletions dist/vuex-orm-axios.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,27 +205,36 @@ var Request = /** @class */ (function () {
Request.prototype.persistResponseData = function (response, config) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
if (!config.save) {
return [2 /*return*/, null];
}
if (config.delete !== undefined) {
return [2 /*return*/, this.model.delete(config.delete)];
switch (_a.label) {
case 0:
if (!config.save) {
return [2 /*return*/, null];
}
if (!(config.delete !== undefined)) return [3 /*break*/, 2];
return [4 /*yield*/, this.model.delete(config.delete)];
case 1:
_a.sent();
return [2 /*return*/, null];
case 2: return [2 /*return*/, this.model.insertOrUpdate({
data: this.getDataFromResponse(response, config)
})];
}
return [2 /*return*/, this.model.insertOrUpdate({
data: this.getDataFromResponse(response, config)
})];
});
});
};
/**
* Get data from the given response object. If the `dataKey` config is
* provided, it tries to fetch the data at that key.
* Get data from the given response object. If the `dataTransformer` config is
* provided, it tries to execute the method with the response as param. If the
* `dataKey` config is provided, it tries to fetch the data at that key.
*/
Request.prototype.getDataFromResponse = function (response, config) {
if (!config.dataKey) {
return response.data;
if (config.dataTransformer) {
return config.dataTransformer(response);
}
if (config.dataKey) {
return response.data[config.dataKey];
}
return response.data[config.dataKey];
return response.data;
};
return Request;
}());
Expand Down
35 changes: 22 additions & 13 deletions dist/vuex-orm-axios.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,27 +203,36 @@ var Request = /** @class */ (function () {
Request.prototype.persistResponseData = function (response, config) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
if (!config.save) {
return [2 /*return*/, null];
}
if (config.delete !== undefined) {
return [2 /*return*/, this.model.delete(config.delete)];
switch (_a.label) {
case 0:
if (!config.save) {
return [2 /*return*/, null];
}
if (!(config.delete !== undefined)) return [3 /*break*/, 2];
return [4 /*yield*/, this.model.delete(config.delete)];
case 1:
_a.sent();
return [2 /*return*/, null];
case 2: return [2 /*return*/, this.model.insertOrUpdate({
data: this.getDataFromResponse(response, config)
})];
}
return [2 /*return*/, this.model.insertOrUpdate({
data: this.getDataFromResponse(response, config)
})];
});
});
};
/**
* Get data from the given response object. If the `dataKey` config is
* provided, it tries to fetch the data at that key.
* Get data from the given response object. If the `dataTransformer` config is
* provided, it tries to execute the method with the response as param. If the
* `dataKey` config is provided, it tries to fetch the data at that key.
*/
Request.prototype.getDataFromResponse = function (response, config) {
if (!config.dataKey) {
return response.data;
if (config.dataTransformer) {
return config.dataTransformer(response);
}
if (config.dataKey) {
return response.data[config.dataKey];
}
return response.data[config.dataKey];
return response.data;
};
return Request;
}());
Expand Down
39 changes: 24 additions & 15 deletions dist/vuex-orm-axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.VuexORMAxios = factory());
}(this, function () { 'use strict';
}(this, (function () { 'use strict';

/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down Expand Up @@ -209,27 +209,36 @@
Request.prototype.persistResponseData = function (response, config) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
if (!config.save) {
return [2 /*return*/, null];
}
if (config.delete !== undefined) {
return [2 /*return*/, this.model.delete(config.delete)];
switch (_a.label) {
case 0:
if (!config.save) {
return [2 /*return*/, null];
}
if (!(config.delete !== undefined)) return [3 /*break*/, 2];
return [4 /*yield*/, this.model.delete(config.delete)];
case 1:
_a.sent();
return [2 /*return*/, null];
case 2: return [2 /*return*/, this.model.insertOrUpdate({
data: this.getDataFromResponse(response, config)
})];
}
return [2 /*return*/, this.model.insertOrUpdate({
data: this.getDataFromResponse(response, config)
})];
});
});
};
/**
* Get data from the given response object. If the `dataKey` config is
* provided, it tries to fetch the data at that key.
* Get data from the given response object. If the `dataTransformer` config is
* provided, it tries to execute the method with the response as param. If the
* `dataKey` config is provided, it tries to fetch the data at that key.
*/
Request.prototype.getDataFromResponse = function (response, config) {
if (!config.dataKey) {
return response.data;
if (config.dataTransformer) {
return config.dataTransformer(response);
}
if (config.dataKey) {
return response.data[config.dataKey];
}
return response.data[config.dataKey];
return response.data;
};
return Request;
}());
Expand Down Expand Up @@ -286,4 +295,4 @@

return index_cjs;

}));
})));
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.7.0",
"version": "0.8.0",
"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 2f0750b

Please sign in to comment.