feima-shortcuts 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/generateApi/index.js +3 -3
package/package.json
CHANGED
package/src/generateApi/index.js
CHANGED
|
@@ -12,7 +12,7 @@ const requestStrFun = (baseUrl) => {
|
|
|
12
12
|
* 请勿手动修改此文件
|
|
13
13
|
*/
|
|
14
14
|
import axios from "axios";
|
|
15
|
-
import type { AxiosResponse, InternalAxiosRequestConfig } from "axios";
|
|
15
|
+
import type { AxiosInstance, AxiosResponse, InternalAxiosRequestConfig } from "axios";
|
|
16
16
|
import { ElMessage } from "element-plus";
|
|
17
17
|
import qs from "qs";
|
|
18
18
|
import { useGlobalStore } from "@/store"; // 路径根据实际情况调整
|
|
@@ -31,7 +31,7 @@ export enum CommonHeaderEnum {
|
|
|
31
31
|
"VERSION" = "VERSION",
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const service:
|
|
34
|
+
const service: AxiosInstance = axios.create({
|
|
35
35
|
baseURL: \`\${import.meta.env.VITE_API_URL}${baseUrl}\`,
|
|
36
36
|
timeout: 50000, // 全局超时时间
|
|
37
37
|
paramsSerializer: {
|
|
@@ -144,7 +144,7 @@ export const request = <T>(
|
|
|
144
144
|
return new CancelablePromise((resolve, reject, onCancel) => {
|
|
145
145
|
const url = \`\${config.BASE}\${options.path}\`;
|
|
146
146
|
|
|
147
|
-
const source =
|
|
147
|
+
const source = axios.CancelToken.source();
|
|
148
148
|
|
|
149
149
|
onCancel(() => source.cancel("The user aborted a request."));
|
|
150
150
|
|