1
+ import type { SimpleObject } from '../types'
1
2
import type { AxiosError , AxiosInstance , Method , AxiosRequestConfig , AxiosResponse } from 'axios'
2
3
import type { IParseOptions } from 'qs'
3
4
import { isObject } from 'lodash'
@@ -23,7 +24,7 @@ export default class BaseService {
23
24
ignoreQueryPrefix : true ,
24
25
}
25
26
26
- constructor ( readonly endpoint : string , public parameters : Record < string , any > = { } ) { }
27
+ constructor ( readonly endpoint : string , public parameters : SimpleObject < any > = { } ) { }
27
28
28
29
get $http ( ) {
29
30
return BaseService . $http
@@ -102,7 +103,7 @@ export default class BaseService {
102
103
const { response } = error
103
104
if ( response && response . status === UNPROCESSABLE_ENTITY ) {
104
105
const { data } = response
105
- const validationErrors : Record < string , any > = { }
106
+ const validationErrors : SimpleObject < any > = { }
106
107
Object . assign ( validationErrors , data [ this . $errorProperty ] )
107
108
this . onFail ( validationErrors )
108
109
}
@@ -131,7 +132,7 @@ export default class BaseService {
131
132
return `${ url } ${ query } `
132
133
}
133
134
134
- setParameters ( parameters : Record < string , any > ) {
135
+ setParameters ( parameters : SimpleObject < any > ) {
135
136
Object . keys ( parameters ) . forEach ( ( key ) => {
136
137
this . parameters [ key ] = parameters [ key ]
137
138
} )
@@ -166,7 +167,7 @@ export default class BaseService {
166
167
return this
167
168
}
168
169
169
- onFail ( errors : Record < string , any > ) {
170
+ onFail ( errors : SimpleObject < any > ) {
170
171
this . errors . fill ( errors )
171
172
validator . fill ( errors )
172
173
}
0 commit comments