Skip to content

Commit ff7a3ee

Browse files
committed
chore: 🏷️ assign simpleobject to baseseverice
1 parent bfb733e commit ff7a3ee

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/core/BaseService.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { SimpleObject } from '../types'
12
import type { AxiosError, AxiosInstance, Method, AxiosRequestConfig, AxiosResponse } from 'axios'
23
import type { IParseOptions } from 'qs'
34
import { isObject } from 'lodash'
@@ -23,7 +24,7 @@ export default class BaseService {
2324
ignoreQueryPrefix: true,
2425
}
2526

26-
constructor(readonly endpoint: string, public parameters: Record<string, any> = {}) {}
27+
constructor(readonly endpoint: string, public parameters: SimpleObject<any> = {}) {}
2728

2829
get $http() {
2930
return BaseService.$http
@@ -102,7 +103,7 @@ export default class BaseService {
102103
const { response } = error
103104
if (response && response.status === UNPROCESSABLE_ENTITY) {
104105
const { data } = response
105-
const validationErrors: Record<string, any> = {}
106+
const validationErrors: SimpleObject<any> = {}
106107
Object.assign(validationErrors, data[this.$errorProperty])
107108
this.onFail(validationErrors)
108109
}
@@ -131,7 +132,7 @@ export default class BaseService {
131132
return `${url}${query}`
132133
}
133134

134-
setParameters(parameters: Record<string, any>) {
135+
setParameters(parameters: SimpleObject<any>) {
135136
Object.keys(parameters).forEach((key) => {
136137
this.parameters[key] = parameters[key]
137138
})
@@ -166,7 +167,7 @@ export default class BaseService {
166167
return this
167168
}
168169

169-
onFail(errors: Record<string, any>) {
170+
onFail(errors: SimpleObject<any>) {
170171
this.errors.fill(errors)
171172
validator.fill(errors)
172173
}

0 commit comments

Comments
 (0)