From c527af97cab2db001309fe5b69788627eaa80bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Sun, 9 Feb 2025 15:51:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=B7=B2=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E8=87=AA=E5=8A=A8=E8=B7=B3=E8=BD=AC=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E7=9B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/utils/http/index.ts | 2 +- web/src/views/login/IndexView.vue | 32 ++++++++++++++----------------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/web/src/utils/http/index.ts b/web/src/utils/http/index.ts index 291e1287..bff83cd0 100644 --- a/web/src/utils/http/index.ts +++ b/web/src/utils/http/index.ts @@ -30,7 +30,7 @@ export const http = createAlova({ console.log(json) const message = resolveResError( code, - json?.message && json.message.trim() !== '' ? json.message : statusText + (typeof json?.message === 'string' && json.message.trim()) || statusText ) const noAlert = meta?.noAlert if (!noAlert) { diff --git a/web/src/views/login/IndexView.vue b/web/src/views/login/IndexView.vue index ed195593..4de22e8f 100644 --- a/web/src/views/login/IndexView.vue +++ b/web/src/views/login/IndexView.vue @@ -65,7 +65,7 @@ async function handleLogin() { await addDynamicRoutes() useRequest(user.info()).onSuccess(({ data }) => { - userStore.set(data) + userStore.set(data as any) }) if (query.redirect) { const path = query.redirect as string @@ -78,25 +78,21 @@ async function handleLogin() { loging.value = false } -watch( - () => isLogin, - async () => { - if (isLogin) { - console.log(isLogin) - await addDynamicRoutes() - useRequest(user.info()).onSuccess(({ data }) => { - userStore.set(data) - }) - if (query.redirect) { - const path = query.redirect as string - Reflect.deleteProperty(query, 'redirect') - await router.push({ path, query }) - } else { - await router.push('/') - } +watch(isLogin, async () => { + if (isLogin) { + await addDynamicRoutes() + useRequest(user.info()).onSuccess(({ data }) => { + userStore.set(data as any) + }) + if (query.redirect) { + const path = query.redirect as string + Reflect.deleteProperty(query, 'redirect') + await router.push({ path, query }) + } else { + await router.push('/') } } -) +})