vue-axios-http
Advanced tools
Comparing version 2.0.1 to 3.0.0
@@ -5,2 +5,28 @@ # Changelog | ||
## [3.0.0](https://github.com/chantouchsek/vue-axios-http/compare/v2.0.1...v3.0.0) (2022-04-19) | ||
### ⚠ BREAKING CHANGES | ||
* renamed all proxy to service | ||
* :fire: rename BaseProxy class to BaseService class | ||
* **break:** remove unused methods | ||
* **methods:** remvoe redundant methods from base proxy class | ||
### Features | ||
* add more options to methods ([66de43c](https://github.com/chantouchsek/vue-axios-http/commit/66de43cf08d89cfc57ff5179e50286c353f46050)) | ||
### Bug Fixes | ||
* check set remove param method ([e8f3cf4](https://github.com/chantouchsek/vue-axios-http/commit/e8f3cf4038fd72a8d0cc476c79a075c43faaa378)) | ||
* make paraeter type to be object type ([129b46d](https://github.com/chantouchsek/vue-axios-http/commit/129b46d88a7ba38621d468eb7f6d0617e5239209)) | ||
* :fire: rename BaseProxy class to BaseService class ([1e486c3](https://github.com/chantouchsek/vue-axios-http/commit/1e486c3ef8c8e6a7a8780d78a671681bd4129369)) | ||
* **break:** remove unused methods ([47f65cb](https://github.com/chantouchsek/vue-axios-http/commit/47f65cbf9cb4c33dc44af693cc8aa9984cd548cb)) | ||
* **methods:** remvoe redundant methods from base proxy class ([4fb5adb](https://github.com/chantouchsek/vue-axios-http/commit/4fb5adb4ad824e8c16d89167a609df6631ebb70b)) | ||
* renamed all proxy to service ([a69a5ba](https://github.com/chantouchsek/vue-axios-http/commit/a69a5ba93982c068ea7370df7b30d6c03178f7a6)) | ||
### [2.0.1](https://github.com/chantouchsek/vue-axios-http/compare/v2.0.0...v2.0.1) (2022-04-19) | ||
@@ -7,0 +33,0 @@ |
import type { ValidatorType } from './core/Validator'; | ||
import BaseProxy from './core/BaseProxy'; | ||
import BaseService from './core/BaseService'; | ||
import Validator from './core/Validator'; | ||
@@ -17,5 +17,5 @@ import _Vue from 'vue'; | ||
} | ||
export { Validator, BaseProxy, BaseProxy as BaseService }; | ||
export { Validator, BaseService }; | ||
export * from './util'; | ||
declare const _default: AxiosHttp; | ||
export default _default; |
@@ -20,6 +20,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BaseService = exports.BaseProxy = exports.Validator = void 0; | ||
const BaseProxy_1 = __importDefault(require("./core/BaseProxy")); | ||
exports.BaseProxy = BaseProxy_1.default; | ||
exports.BaseService = BaseProxy_1.default; | ||
exports.BaseService = exports.Validator = void 0; | ||
const BaseService_1 = __importDefault(require("./core/BaseService")); | ||
exports.BaseService = BaseService_1.default; | ||
const Validator_1 = __importDefault(require("./core/Validator")); | ||
@@ -48,5 +47,5 @@ exports.Validator = Validator_1.default; | ||
const { $axios, errorProperty, parsedQs } = defaultOption; | ||
BaseProxy_1.default.$http = $axios; | ||
BaseProxy_1.default.$errorProperty = errorProperty || 'errors'; | ||
BaseProxy_1.default.$parsedQs = parsedQs || this.parsedQs; | ||
BaseService_1.default.$http = $axios; | ||
BaseService_1.default.$errorProperty = errorProperty || 'errors'; | ||
BaseService_1.default.$parsedQs = parsedQs || this.parsedQs; | ||
Vue.mixin({ | ||
@@ -53,0 +52,0 @@ beforeCreate() { |
import Vue from 'vue' | ||
import AxiosHttp, { BaseProxy, Validator } from 'vue-axios-http' | ||
import AxiosHttp, { BaseService, Validator } from 'vue-axios-http' | ||
@@ -10,4 +10,4 @@ const errorProperty = '<%= options.errorProperty %>' | ||
export default function ({ $axios }, inject) { | ||
BaseProxy.$http = $axios | ||
BaseService.$http = $axios | ||
inject('errors', Validator) | ||
} |
{ | ||
"name": "vue-axios-http", | ||
"version": "2.0.1", | ||
"version": "3.0.0", | ||
"description": "Elegant and simple way to build requests for REST API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -13,3 +13,3 @@ # Vue Axios Http | ||
Wouldn't it be great if you could just use your back end to validate forms on the front end? This package provides a | ||
`BaseProxy` class that does exactly that. It can post itself to a configured endpoint and manage errors. The class is | ||
`BaseService` class that does exactly that. It can post itself to a configured endpoint and manage errors. The class is | ||
meant to be used with a Laravel back end, and it doesn't limit that you need only to work with laravel, Ruby on Rail, | ||
@@ -131,8 +131,8 @@ NodeJs, ExpressJs, or any other languages. | ||
`~/proxies/NewsProxy.js` | ||
`~/proxies/NewsService.js` | ||
```js | ||
import { BaseProxy } from 'vue-axios-http' | ||
import { BaseService } from 'vue-axios-http' | ||
class NewsProxy extends BaseProxy { | ||
class NewsService extends BaseService { | ||
constructor(parameters = {}) { | ||
@@ -143,3 +143,3 @@ super('news', parameters) | ||
export default NewsProxy | ||
export default NewsService | ||
``` | ||
@@ -163,7 +163,7 @@ | ||
import { ALL } from './mutation-types' | ||
import { NewsProxy } from '~/proxies' | ||
import { NewsService } from '~/proxies' | ||
import { BaseTransformer, PaginationTransformer } from 'vue-axios-http' | ||
import { pagination, notify } from '~/utils' | ||
const proxy = new NewsProxy() | ||
const service = new NewsService() | ||
@@ -173,6 +173,6 @@ const all = async ({ commit, dispatch }, payload = {}) => { | ||
if (typeof fn === 'function') { | ||
await fn(proxy) | ||
await fn(service) | ||
} | ||
try { | ||
const { data, meta } = await proxy.all() | ||
const { data, meta } = await service.all() | ||
const all = { | ||
@@ -255,4 +255,4 @@ items: BaseTransformer.fetchCollection(data), | ||
await store.dispatch('news/all', { | ||
fn: (proxy) => { | ||
proxy | ||
fn: (service) => { | ||
service | ||
.setParameters({ | ||
@@ -276,4 +276,4 @@ userId: id, | ||
this.$store.dispatch('news/all', { | ||
fn: (proxy) => { | ||
proxy | ||
fn: (service) => { | ||
service | ||
.setParameters({ | ||
@@ -292,3 +292,3 @@ userId: id, | ||
## Proxy's methods are available | ||
## Service's methods are available | ||
@@ -312,3 +312,3 @@ | Method | Description | | ||
```js | ||
const proxy = new ExampleProxy() | ||
const service = new ExampleService() | ||
const parameters = { | ||
@@ -329,3 +329,3 @@ search: { | ||
} | ||
const { data } = proxy.setParameters(parameters).all() | ||
const { data } = service.setParameters(parameters).all() | ||
this.data = data | ||
@@ -347,4 +347,4 @@ ``` | ||
```js | ||
const proxy = new ExampleProxy() | ||
const { data } = await proxy.setParameter('page', 1).all() | ||
const service = new ExampleService() | ||
const { data } = await service.setParameter('page', 1).all() | ||
this.data = data | ||
@@ -364,5 +364,5 @@ ``` | ||
```js | ||
const proxy = new ExampleProxy() | ||
const service = new ExampleService() | ||
const queryString = 'limit=10&page=1&search[name]=hello' | ||
const { data } = await proxy.setParameter(queryString).all() | ||
const { data } = await service.setParameter(queryString).all() | ||
this.data = data | ||
@@ -385,3 +385,3 @@ ``` | ||
## Use proxy in components | ||
## Use service in components | ||
@@ -391,5 +391,5 @@ - news/\_id.vue pages | ||
```js | ||
import { NewsProxy } from '~/proxies' | ||
import { NewsService } from '~/proxies' | ||
const proxy = new NewsProxy() | ||
const service = new NewsService() | ||
@@ -400,3 +400,3 @@ export default { | ||
try { | ||
const { data } = await proxy.find(id) | ||
const { data } = await service.find(id) | ||
this.detail = data | ||
@@ -403,0 +403,0 @@ } catch (e) { |
49085
781