feat: upgrade common request api type

This commit is contained in:
IchliebedichZhu 2024-03-01 21:21:53 +00:00
parent e509541711
commit e580ea3239
2 changed files with 6 additions and 4 deletions

View File

@ -11,8 +11,10 @@ import fetch from '@/utils/axios'
export const getKinds = (params: Type.Object = {}) => fetch('design/cate', params) export const getKinds = (params: Type.Object = {}) => fetch('design/cate', params)
type TGetListParam = { type TGetListParam = {
cate: number first_id?: number
pageSize: number second_id?: string
cate?: number
pageSize?: number
} }
export type TGetListData = { export type TGetListData = {

View File

@ -85,7 +85,7 @@ const fetch = <T = any> (
type: TFetchMethod = 'get', type: TFetchMethod = 'get',
exheaders: Record<string, any> = {}, exheaders: Record<string, any> = {},
extra: Record<string, any> = {} extra: Record<string, any> = {}
): Promise<AxiosResponse<T>> => { ): Promise<T> => {
if (params?._noLoading) { if (params?._noLoading) {
delete params._noLoading delete params._noLoading
} else { } else {
@ -106,7 +106,7 @@ const fetch = <T = any> (
return axios[type](url, params, { return axios[type](url, params, {
headers: Object.assign(headerObject, exheaders), headers: Object.assign(headerObject, exheaders),
...extra, ...extra,
}) as Promise<AxiosResponse<T>> }) as Promise<T>
} }
} }