feat: 接口增加泛型支持

This commit is contained in:
a876691666
2022-11-27 12:16:32 +08:00
parent 02ec3c78d6
commit f8ebaa60b1
8 changed files with 153 additions and 68 deletions
+3 -3
View File
@@ -8,14 +8,14 @@ import { redirectErrorPage, getLocalStorage, routerTurnByName, isPreview } from
import { fetchAllowList } from './axios.config'
import includes from 'lodash/includes'
export interface MyResponseType {
export interface MyResponseType<T> {
code: ResultEnum
data: any
data: T
message: string
}
export interface MyRequestInstance extends Axios {
(config: AxiosRequestConfig): Promise<MyResponseType>
<T = any>(config: AxiosRequestConfig): Promise<MyResponseType<T>>
}
const axiosInstance = axios.create({