perf: improve the login process

This commit is contained in:
vince
2024-07-11 21:48:56 +08:00
parent d62a3da009
commit c4c8103af2
5 changed files with 28 additions and 29 deletions

View File

@@ -1,31 +1,11 @@
<script lang="ts" setup>
import type { LoginAndRegisterParams } from '@vben/universal-ui';
import { AuthenticationLogin } from '@vben/universal-ui';
import { App } from 'ant-design-vue';
import { $t } from '#/locales';
import { useAccessStore } from '#/store';
defineOptions({ name: 'Login' });
const accessStore = useAccessStore();
const { notification } = App.useApp();
/**
* @param params 登录表单数据
*/
async function handleLogin(params: LoginAndRegisterParams) {
const { userInfo } = await accessStore.authLogin(params);
if (userInfo?.realName) {
notification.success({
description: `${$t('authentication.loginSuccessDesc')}:${userInfo?.realName}`,
duration: 3,
message: $t('authentication.loginSuccess'),
});
}
}
</script>
<template>
@@ -33,6 +13,6 @@ async function handleLogin(params: LoginAndRegisterParams) {
:loading="accessStore.loading"
password-placeholder="123456"
username-placeholder="vben"
@submit="handleLogin"
@submit="accessStore.authLogin"
/>
</template>