vue-axios-http
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -5,2 +5,13 @@ # Changelog | ||
### [0.0.2](https://github.com/chantouchsek/vue-axios/compare/v0.0.1...v0.0.2) (2021-12-12) | ||
### Bug Fixes | ||
* :fire: fix eslint ([a99a557](https://github.com/chantouchsek/vue-axios/commit/a99a557cf675cb83b213701909a122a06395e5cc)) | ||
* change config and fixed test ([b0b94eb](https://github.com/chantouchsek/vue-axios/commit/b0b94eb8a17aab6d6e101fa70932226f694a8526)) | ||
* **deps:** bump actions/checkout from 2.3.4 to 2.4.0 ([6556908](https://github.com/chantouchsek/vue-axios/commit/6556908d9d88c11ae5b9b6b60cb072f02e295a8a)) | ||
* **deps:** bump actions/setup-node from 2.4.1 to 2.5.0 ([8b02b21](https://github.com/chantouchsek/vue-axios/commit/8b02b211e17065241226ff4513bc60a12d90fafb)) | ||
* fix nuxt optiion ([65bba48](https://github.com/chantouchsek/vue-axios/commit/65bba48da9a6abf477ea51b16a6efe060bcaefcf)) | ||
### 0.0.1 (2021-12-11) |
@@ -12,3 +12,3 @@ /// <reference types="@types/qs" /> | ||
readonly endpoint: string; | ||
static $http?: AxiosInstance; | ||
static $http: AxiosInstance; | ||
static $errorProperty: string; | ||
@@ -15,0 +15,0 @@ static $parsedQs: IParseOptions; |
@@ -151,8 +151,8 @@ "use strict"; | ||
const data = (0, util_1.hasFiles)(form) ? (0, util_1.objectToFormData)(form) : form; | ||
const url = parameter | ||
const endpoint = parameter | ||
? `/${this.endpoint}/${parameter}` | ||
: `/${this.endpoint}`; | ||
const endpoint = this.__getParameterString((0, util_1.removeDoubleSlash)(url)); | ||
config = Object.assign({}, config, { data, method }); | ||
this.$http(endpoint, config) | ||
const url = this.__getParameterString((0, util_1.removeDoubleSlash)(endpoint)); | ||
config = Object.assign({}, config, { url, data, method }); | ||
this.$http(config) | ||
.then((response) => { | ||
@@ -186,3 +186,3 @@ this.onSuccess(); | ||
const requestTypes = ['get', 'delete', 'head', 'post', 'put', 'patch']; | ||
if (!requestTypes.includes(requestType)) { | ||
if (!requestTypes.includes(requestType.toLowerCase())) { | ||
throw new Error(`\`${requestType}\` is not a valid request type, ` + | ||
@@ -257,3 +257,3 @@ `must be one of: \`${requestTypes.join('`, `')}\`.`); | ||
if (!this.$http) { | ||
throw new Error('Vue Api Queries, No http library provided.'); | ||
throw new Error('Vue Axios Http, No http library provided.'); | ||
} | ||
@@ -260,0 +260,0 @@ this.errors.flush(); |
@@ -7,6 +7,4 @@ declare class BaseTransformer { | ||
static fetch<T = any>(item: T, camelKey?: boolean): T | Record<string, any>; | ||
static send<T = any>(item: T, snakeKey?: boolean): { | ||
[key: string]: any; | ||
}; | ||
static send<T = any>(item: T, snakeKey?: boolean): T | Record<string, any>; | ||
} | ||
export default BaseTransformer; |
import { resolve, join } from 'path' | ||
module.exports = function nuxtAxiosHttpModule(moduleOptions = {}) { | ||
const { AxiosHttp = {} } = this.options | ||
const options = Object.assign({}, moduleOptions, AxiosHttp) | ||
const { axiosHttp = {} } = this.options | ||
const options = Object.assign({}, moduleOptions, axiosHttp) | ||
this.addPlugin({ | ||
@@ -7,0 +7,0 @@ options, |
{ | ||
"name": "vue-axios-http", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Elegant and simple way to build requests for REST API", | ||
@@ -49,3 +49,3 @@ "main": "dist/index.js", | ||
"@commitlint/cli": "^13.1.0", | ||
"@commitlint/config-conventional": "^13.1.0", | ||
"@commitlint/config-conventional": "^15.0.0", | ||
"@nuxt/types": "^2.15.8", | ||
@@ -55,3 +55,3 @@ "@types/jest": "^27.0.1", | ||
"@types/qs": "^6.9.7", | ||
"@typescript-eslint/eslint-plugin": "^4.31.1", | ||
"@typescript-eslint/eslint-plugin": "^4.33.0", | ||
"@typescript-eslint/parser": "^4.31.1", | ||
@@ -62,7 +62,7 @@ "@vue/test-utils": "^1.2.2", | ||
"eslint": "^7.32.0", | ||
"eslint-config-prettier": "^7.2.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.24.2", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"eslint-plugin-promise": "^5.1.0", | ||
"husky": "^7.0.2", | ||
"husky": "^7.0.4", | ||
"jest": "^27.2.0", | ||
@@ -74,3 +74,3 @@ "nodemon": "^2.0.12", | ||
"standard-version": "^9.3.1", | ||
"ts-jest": "^27.0.5", | ||
"ts-jest": "^27.1.1", | ||
"typescript": "^4.5.3", | ||
@@ -84,6 +84,6 @@ "vue": "^2.6.14" | ||
"dependencies": { | ||
"camelcase-keys": "^7.0.0", | ||
"camelcase-keys": "^7.0.1", | ||
"qs": "^6.10.2", | ||
"snakecase-keys": "^5.0.0" | ||
"snakecase-keys": "^5.1.2" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# Vue Api Queries. | ||
# Vue Axios Http | ||
@@ -50,6 +50,6 @@ [![Build Status](https://travis-ci.com/chantouchsek/vue-axios-http.svg?branch=master)](https://travis-ci.com/chantouchsek/vue-axios-http) | ||
// With options | ||
['vue-axios-http/nuxt', { errorProperty: 'errors', blockDuplicate: false }], | ||
['vue-axios-http/nuxt', { errorProperty: 'errors' }], | ||
'@nuxtjs/axios', | ||
], | ||
AxiosHttp: { errorProperty: 'errors', blockDuplicate: false }, | ||
axiosHttp: { errorProperty: 'errors' }, | ||
} | ||
@@ -56,0 +56,0 @@ ``` |
50336
1074
Updatedcamelcase-keys@^7.0.1
Updatedsnakecase-keys@^5.1.2