File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -50,10 +50,10 @@ export default {
5050 // simple usage
5151 ' vue-api-queries/nuxt' ,
5252 // With options
53- [' vue-api-queries/nuxt' , { errorsKeyName : ' errors' }],
53+ [' vue-api-queries/nuxt' , { errorProperty : ' errors' }],
5454 ' @nuxtjs/axios' ,
5555 ],
56- apiQueries: { errorsKeyName : ' errors' },
56+ apiQueries: { errorProperty : ' errors' },
5757}
5858```
5959
Original file line number Diff line number Diff line change 11import Vue from 'vue'
22import VueApiQueries , { Validator , BaseProxy } from 'vue-api-queries'
33
4- const errorsKey = '<%= options.errorsKeyName %>'
4+ const errorProperty = '<%= options.errorProperty %>'
55
66export default function ( ctx ) {
77 Vue . use ( VueApiQueries )
88 ctx . $errors = Validator
99 BaseProxy . $http = ctx . $axios
10- BaseProxy . $errorsKey = errorsKey || 'errors'
10+ BaseProxy . $errorProperty = errorProperty || 'errors'
1111 // inject('queries', BaseProxy)
1212}
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ class BaseProxy {
2424 public parameters : any | any [ ]
2525 public readonly endpoint : string
2626 public static $http : AxiosInstance | undefined
27- public static $errorsKey = 'errors'
27+ public static $errorProperty = 'errors'
2828
2929 constructor ( endpoint : string , parameters ?: ParametersType ) {
3030 this . endpoint = endpoint
@@ -36,8 +36,8 @@ class BaseProxy {
3636 return < AxiosInstance > BaseProxy . $http
3737 }
3838
39- get $errorsKey ( ) {
40- return BaseProxy . $errorsKey
39+ get $errorProperty ( ) {
40+ return BaseProxy . $errorProperty
4141 }
4242
4343 /**
@@ -201,7 +201,7 @@ class BaseProxy {
201201 const { data, status } = response
202202 if ( status === UNPROCESSABLE_ENTITY ) {
203203 const errors = { }
204- Object . assign ( errors , data [ this . $errorsKey ] )
204+ Object . assign ( errors , data [ this . $errorProperty ] )
205205 this . onFail ( errors )
206206 }
207207 reject ( error )
You can’t perform that action at this time.
0 commit comments