From e201ff071fdb3cbc9a8017e3e739e5d8b4fc0d4b Mon Sep 17 00:00:00 2001 From: chansee97 Date: Wed, 5 Jun 2024 09:53:46 +0800 Subject: [PATCH] fix: login fetch error --- src/store/auth.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/store/auth.ts b/src/store/auth.ts index 4657948..d262a1e 100644 --- a/src/store/auth.ts +++ b/src/store/auth.ts @@ -53,12 +53,16 @@ export const useAuthStore = defineStore('auth-store', { /* 用户登录 */ async login(userName: string, password: string) { - const { isSuccess, data } = await fetchLogin({ userName, password }) - if (!isSuccess) - return + try { + const { isSuccess, data } = await fetchLogin({ userName, password }) + if (!isSuccess) + return - // 处理登录信息 - await this.handleAfterLogin(data) + // 处理登录信息 + await this.handleAfterLogin(data) + } + catch (e) { + } }, /* 登录后的处理函数 */