From ff7a3eeccd9b109eb91a393e9fb0cb0a434d9b29 Mon Sep 17 00:00:00 2001 From: Touch Date: Wed, 27 Sep 2023 11:27:40 +0700 Subject: [PATCH] chore: :label: assign simpleobject to baseseverice --- src/core/BaseService.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core/BaseService.ts b/src/core/BaseService.ts index ea38775a..4c79633b 100644 --- a/src/core/BaseService.ts +++ b/src/core/BaseService.ts @@ -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' @@ -23,7 +24,7 @@ export default class BaseService { ignoreQueryPrefix: true, } - constructor(readonly endpoint: string, public parameters: Record = {}) {} + constructor(readonly endpoint: string, public parameters: SimpleObject = {}) {} get $http() { return BaseService.$http @@ -102,7 +103,7 @@ export default class BaseService { const { response } = error if (response && response.status === UNPROCESSABLE_ENTITY) { const { data } = response - const validationErrors: Record = {} + const validationErrors: SimpleObject = {} Object.assign(validationErrors, data[this.$errorProperty]) this.onFail(validationErrors) } @@ -131,7 +132,7 @@ export default class BaseService { return `${url}${query}` } - setParameters(parameters: Record) { + setParameters(parameters: SimpleObject) { Object.keys(parameters).forEach((key) => { this.parameters[key] = parameters[key] }) @@ -166,7 +167,7 @@ export default class BaseService { return this } - onFail(errors: Record) { + onFail(errors: SimpleObject) { this.errors.fill(errors) validator.fill(errors) }