vue-axios-http
Advanced tools
Comparing version 3.1.0 to 3.1.1
@@ -5,2 +5,12 @@ # Changelog | ||
### [3.1.1](https://github.com/chantouchsek/vue-axios-http/compare/v3.1.0...v3.1.1) (2022-07-08) | ||
### Bug Fixes | ||
* :fire: make fill method print the same the value from api ([ddb6b08](https://github.com/chantouchsek/vue-axios-http/commit/ddb6b085b071d6766f4e5cde50deed3db34a275c)) | ||
* **deps:** bump parse-url from 6.0.0 to 6.0.2 ([3e71ffb](https://github.com/chantouchsek/vue-axios-http/commit/3e71ffb4786ac056bb444bae2840bed44549c75c)) | ||
* **deps:** bump qs from 6.10.5 to 6.11.0 ([5ebc28f](https://github.com/chantouchsek/vue-axios-http/commit/5ebc28fbd24497aad09639a1a9b02912f583d668)) | ||
* **deps:** bump shell-quote from 1.7.2 to 1.7.3 ([db6a556](https://github.com/chantouchsek/vue-axios-http/commit/db6a5565d78b8bdd5128eaafca7a9dc7c931e7cf)) | ||
## [3.1.0](https://github.com/chantouchsek/vue-axios-http/compare/v3.0.1...v3.1.0) (2022-06-19) | ||
@@ -7,0 +17,0 @@ |
@@ -18,21 +18,15 @@ /// <reference types="@types/qs" /> | ||
find<T>(id: number | string): Promise<T>; | ||
post<T>(payload: any): Promise<T>; | ||
post<T>(payload: any, config?: AxiosRequestConfig): Promise<T>; | ||
store<T>(payload: any): Promise<T>; | ||
store<T>(payload: any, config?: AxiosRequestConfig): Promise<T>; | ||
put<T>(payload: any, config?: AxiosRequestConfig): Promise<T>; | ||
put<T>(id: string | number, payload: any, config?: AxiosRequestConfig): Promise<T>; | ||
patch<T>(payload: any, config?: AxiosRequestConfig): Promise<T>; | ||
patch<T>(id: string | number, payload: any, config?: AxiosRequestConfig): Promise<T>; | ||
put<T>(id: any, payload?: any, config?: AxiosRequestConfig): Promise<T>; | ||
patch<T>(id: any, payload?: any, config?: AxiosRequestConfig): Promise<T>; | ||
update<T>(id: string | number, payload: any): Promise<T>; | ||
delete<T>(id: string | number): Promise<T>; | ||
remove<T>(id: string | number): Promise<T>; | ||
submit<T = any>(requestType: Method, parameter?: string | number, form?: T, config?: AxiosRequestConfig): Promise<T>; | ||
submit<T = any>(method: Method, parameter?: string | number, form?: T, config?: AxiosRequestConfig): Promise<T>; | ||
private __getParameterString; | ||
private static __validateRequestType; | ||
setParameters(parameters: Record<string, any>): this; | ||
setParameter(parameter: string): this; | ||
setParameter(parameter: string, value?: any): this; | ||
removeParameters(): this; | ||
removeParameters(parameters: any[]): this; | ||
removeParameters(parameters?: any[]): this; | ||
removeParameter(parameter: string): this; | ||
@@ -39,0 +33,0 @@ onFail(errors: Record<string, any>): void; |
@@ -61,4 +61,4 @@ "use strict"; | ||
} | ||
submit(requestType, parameter, form, config) { | ||
const method = BaseService.__validateRequestType(requestType); | ||
submit(method, parameter, form, config) { | ||
BaseService.__validateRequestType(method); | ||
this.beforeSubmit(); | ||
@@ -65,0 +65,0 @@ return new Promise((resolve, reject) => { |
@@ -5,3 +5,3 @@ declare class Validator { | ||
processing: boolean; | ||
constructor(); | ||
constructor(errors?: Record<string, any>); | ||
add(attribute: string, message: string): void; | ||
@@ -8,0 +8,0 @@ has(field: string | string[]): boolean; |
@@ -10,6 +10,6 @@ "use strict"; | ||
class Validator { | ||
constructor() { | ||
constructor(errors = {}) { | ||
this.processing = false; | ||
this.successful = false; | ||
this.errors = {}; | ||
this.errors = errors; | ||
} | ||
@@ -25,3 +25,3 @@ add(attribute, message) { | ||
has(field) { | ||
if ((0, util_1.isArray)(field)) { | ||
if (Array.isArray(field)) { | ||
return (0, util_1.is)(Object.keys(this.errors), field); | ||
@@ -58,3 +58,3 @@ } | ||
} | ||
if ((0, util_1.isArray)(value)) | ||
if (Array.isArray(value)) | ||
value = value[0]; | ||
@@ -95,10 +95,2 @@ return value; | ||
fill(errors) { | ||
for (const error in errors) { | ||
if (!(0, util_1.hasOwnProperty)(errors, error)) { | ||
continue; | ||
} | ||
if (!(errors[error] instanceof Array)) { | ||
errors[error] = [errors[error]]; | ||
} | ||
} | ||
this.errors = errors; | ||
@@ -105,0 +97,0 @@ } |
{ | ||
"name": "vue-axios-http", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "Elegant and simple way to build requests for REST API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
52123
769