fix(projects): fix router when the dynamic routes api was failed [修复当动态路由接口失败后路由异常问题]

This commit is contained in:
Soybean
2022-11-17 22:54:45 +08:00
parent 3bd8858121
commit f2b580fc06
2 changed files with 17 additions and 8 deletions

View File

@ -52,6 +52,7 @@ export const useAuthStore = defineStore('auth-store', {
* @param backendToken - 返回的token
*/
async handleActionAfterLogin(backendToken: ApiAuth.Token) {
const route = useRouteStore();
const { toLoginRedirect } = useRouterPush(false);
const loginSuccess = await this.loginByToken(backendToken);
@ -61,11 +62,13 @@ export const useAuthStore = defineStore('auth-store', {
toLoginRedirect();
// 登录成功弹出欢迎提示
window.$notification?.success({
title: '登录成功!',
content: `欢迎回来,${this.userInfo.userName}!`,
duration: 3000
});
if (route.isInitAuthRoute) {
window.$notification?.success({
title: '登录成功!',
content: `欢迎回来,${this.userInfo.userName}!`,
duration: 3000
});
}
return;
}