From 8d2ef1f644f1a45b710efc2610b92fbb012cbc86 Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Thu, 4 Apr 2024 15:23:02 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/user.ts | 6 ++---- src/views/login/index.vue | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index f2ecab4c1f..e4a78e7c22 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -55,10 +55,8 @@ export const useUserStore = defineStore({ return new Promise((resolve, reject) => { getLogin(data) .then(data => { - if (data) { - setToken(data.data); - resolve(data); - } + if (data?.success) setToken(data.data); + resolve(data); }) .catch(error => { reject(error); diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 5979c903de..6eb5db3e89 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -81,6 +81,8 @@ const onLogin = async (formEl: FormInstance | undefined) => { }) .finally(() => (disabled.value = false)); }); + } else { + message("登录失败", { type: "error" }); } }) .finally(() => (loading.value = false));