Skip to content

Commit

Permalink
perf: 优化登录接口
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxian521 committed Apr 4, 2024
1 parent fcd0fc9 commit 8d2ef1f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/store/modules/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/views/login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ const onLogin = async (formEl: FormInstance | undefined) => {
})
.finally(() => (disabled.value = false));
});
} else {
message("登录失败", { type: "error" });
}
})
.finally(() => (loading.value = false));
Expand Down

0 comments on commit 8d2ef1f

Please sign in to comment.