perf: 优化登录接口

This commit is contained in:
xiaoxian521 2024-04-04 15:23:02 +08:00
parent fcd0fc9d65
commit 8d2ef1f644
2 changed files with 4 additions and 4 deletions

View File

@ -55,10 +55,8 @@ export const useUserStore = defineStore({
return new Promise<UserResult>((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);

View File

@ -81,6 +81,8 @@ const onLogin = async (formEl: FormInstance | undefined) => {
})
.finally(() => (disabled.value = false));
});
} else {
message("登录失败", { type: "error" });
}
})
.finally(() => (loading.value = false));