mirror of
https://github.com/palxiao/poster-design.git
synced 2025-07-15 16:02:19 +08:00
feat: upgrade common request api type
This commit is contained in:
parent
e509541711
commit
e580ea3239
@ -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 = {
|
||||||
|
@ -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>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user