feima-shortcuts 1.0.3 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feima-shortcuts",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "快捷指令",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -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: any = axios.create({
34
+ const service: AxiosInstance = axios.create({
35
35
  baseURL: \`\${import.meta.env.VITE_API_URL}${baseUrl}\`,
36
36
  timeout: 50000, // 全局超时时间
37
37
  paramsSerializer: {
@@ -143,16 +143,16 @@ export const request = <T>(
143
143
  ): CancelablePromise<T> => {
144
144
  return new CancelablePromise((resolve, reject, onCancel) => {
145
145
  const url = \`\${config.BASE}\${options.path}\`;
146
-
147
- const source = service.CancelToken.source();
146
+
147
+ const source = axios.CancelToken.source();
148
148
 
149
149
  onCancel(() => source.cancel("The user aborted a request."));
150
150
 
151
151
  service
152
152
  .request({
153
+ ...options,
153
154
  url,
154
155
  data: options.body,
155
- ...options,
156
156
  cancelToken: source.token,
157
157
  })
158
158
  .then((data: any) => {