mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-08 01:17:23 +08:00
perf: 优化登录接口
This commit is contained in:
parent
fcd0fc9d65
commit
8d2ef1f644
@ -55,10 +55,8 @@ export const useUserStore = defineStore({
|
|||||||
return new Promise<UserResult>((resolve, reject) => {
|
return new Promise<UserResult>((resolve, reject) => {
|
||||||
getLogin(data)
|
getLogin(data)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (data) {
|
if (data?.success) setToken(data.data);
|
||||||
setToken(data.data);
|
resolve(data);
|
||||||
resolve(data);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
reject(error);
|
reject(error);
|
||||||
|
@ -81,6 +81,8 @@ const onLogin = async (formEl: FormInstance | undefined) => {
|
|||||||
})
|
})
|
||||||
.finally(() => (disabled.value = false));
|
.finally(() => (disabled.value = false));
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
message("登录失败", { type: "error" });
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.finally(() => (loading.value = false));
|
.finally(() => (loading.value = false));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user