feat: add backend-mock app
This commit is contained in:
@@ -4,6 +4,7 @@ import type { LoginAndRegisterParams } from '@vben/universal-ui';
|
||||
import { computed } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { DEFAULT_HOME_PATH } from '@vben/constants';
|
||||
import { $t } from '@vben/locales';
|
||||
import { AuthenticationLogin } from '@vben/universal-ui';
|
||||
import { useRequest } from '@vben-core/request';
|
||||
@@ -39,7 +40,7 @@ async function handleLogin(values: LoginAndRegisterParams) {
|
||||
// 异步处理用户登录操作并获取 accessToken
|
||||
// Asynchronously handle the user login operation and obtain the accessToken
|
||||
|
||||
const { accessToken } = await runUserLogin(values);
|
||||
const { accessToken, refreshToken } = await runUserLogin(values);
|
||||
|
||||
// 如果成功获取到 accessToken
|
||||
// If accessToken is successfully obtained
|
||||
@@ -47,15 +48,17 @@ async function handleLogin(values: LoginAndRegisterParams) {
|
||||
// 将 accessToken 存储到 accessStore 中
|
||||
// Store the accessToken in accessStore
|
||||
accessStore.setAccessToken(accessToken);
|
||||
accessStore.setRefreshToken(refreshToken);
|
||||
|
||||
// 获取用户信息并存储到 accessStore 中
|
||||
// Get user information and store it in accessStore
|
||||
const userInfo = await runGetUserInfo();
|
||||
|
||||
accessStore.setUserInfo(userInfo);
|
||||
|
||||
// 跳转到用户信息中定义的 homePath 路径
|
||||
// Redirect to the homePath defined in the user information
|
||||
await router.push(userInfo.homePath);
|
||||
await router.push(userInfo.homePath || DEFAULT_HOME_PATH);
|
||||
notification.success({
|
||||
description: `${$t('authentication.login-success-desc')}:${userInfo.realName}`,
|
||||
duration: 3,
|
||||
|
Reference in New Issue
Block a user