Skip to content

Commit

Permalink
chore: 🏷️ assign simpleobject to baseseverice
Browse files Browse the repository at this point in the history
  • Loading branch information
chantouchsek committed Sep 27, 2023
1 parent bfb733e commit ff7a3ee
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/core/BaseService.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { SimpleObject } from '../types'
import type { AxiosError, AxiosInstance, Method, AxiosRequestConfig, AxiosResponse } from 'axios'
import type { IParseOptions } from 'qs'
import { isObject } from 'lodash'
Expand All @@ -23,7 +24,7 @@ export default class BaseService {
ignoreQueryPrefix: true,
}

constructor(readonly endpoint: string, public parameters: Record<string, any> = {}) {}
constructor(readonly endpoint: string, public parameters: SimpleObject<any> = {}) {}

get $http() {
return BaseService.$http
Expand Down Expand Up @@ -102,7 +103,7 @@ export default class BaseService {
const { response } = error
if (response && response.status === UNPROCESSABLE_ENTITY) {
const { data } = response
const validationErrors: Record<string, any> = {}
const validationErrors: SimpleObject<any> = {}
Object.assign(validationErrors, data[this.$errorProperty])
this.onFail(validationErrors)
}
Expand Down Expand Up @@ -131,7 +132,7 @@ export default class BaseService {
return `${url}${query}`
}

setParameters(parameters: Record<string, any>) {
setParameters(parameters: SimpleObject<any>) {
Object.keys(parameters).forEach((key) => {
this.parameters[key] = parameters[key]
})
Expand Down Expand Up @@ -166,7 +167,7 @@ export default class BaseService {
return this
}

onFail(errors: Record<string, any>) {
onFail(errors: SimpleObject<any>) {
this.errors.fill(errors)
validator.fill(errors)
}
Expand Down

0 comments on commit ff7a3ee

Please sign in to comment.