From 5a705f9a44bcb105a8621b2e42e727ba2ca715d9 Mon Sep 17 00:00:00 2001 From: h_mo <596417202@qq.com> Date: Tue, 20 Aug 2024 14:30:40 +0800 Subject: [PATCH] =?UTF-8?q?refactor(http):=20=E5=8D=87=E7=BA=A7alova?= =?UTF-8?q?=E5=88=B0v3,=20=E4=BC=98=E5=8C=96=E7=8A=B6=E6=80=81=E7=A0=81?= =?UTF-8?q?=E5=92=8C=E9=80=BB=E8=BE=91=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/vitePlugins.ts | 2 +- package.json | 6 ++--- src/pages/about/index.vue | 2 +- src/pages/index/index.vue | 2 +- src/pages/log/index.vue | 2 +- src/router/guard.ts | 2 -- src/stores/modules/user.ts | 1 - .../{checkStatus.ts => faultTolerance.ts} | 27 ++++++++++++++++++- src/utils/http/index.ts | 21 ++++++++++----- 9 files changed, 48 insertions(+), 17 deletions(-) rename src/utils/http/{checkStatus.ts => faultTolerance.ts} (73%) diff --git a/build/vitePlugins.ts b/build/vitePlugins.ts index f614f3e..b3b8877 100644 --- a/build/vitePlugins.ts +++ b/build/vitePlugins.ts @@ -35,7 +35,7 @@ export function createVitePlugins({ isProd }: VitePluginConfig): PluginOption[] 'uni-mini-router': ['useRouter', 'useRoute'], }, { - alova: ['useRequest'], + 'alova/client': ['useRequest'], }, ], dts: 'typings/auto-imports.d.ts', diff --git a/package.json b/package.json index 986f20d..20a148b 100644 --- a/package.json +++ b/package.json @@ -36,8 +36,8 @@ "postinstall": "weapp-tw patch" }, "dependencies": { - "@alova/adapter-uniapp": "^1.2.2", - "@alova/mock": "^1.5.2", + "@alova/adapter-uniapp": "^2.0.4", + "@alova/mock": "^2.0.4", "@dcloudio/uni-app": "3.0.0-alpha-4020520240808001", "@dcloudio/uni-app-plus": "3.0.0-alpha-4020520240808001", "@dcloudio/uni-components": "3.0.0-alpha-4020520240808001", @@ -52,7 +52,7 @@ "@dcloudio/uni-mp-weixin": "3.0.0-alpha-4020520240808001", "@dcloudio/uni-quickapp-webview": "3.0.0-alpha-4020520240808001", "@multiavatar/multiavatar": "^1.0.7", - "alova": "^2.21.4", + "alova": "^3.0.9", "crypto-js": "^4.2.0", "lodash-es": "^4.17.21", "pinia": "^2.2.2", diff --git a/src/pages/about/index.vue b/src/pages/about/index.vue index dedd434..1472bf1 100644 --- a/src/pages/about/index.vue +++ b/src/pages/about/index.vue @@ -19,7 +19,7 @@ function handleLoginOut() {