Skip to content

Commit

Permalink
fix: 修复登录后访问首页却跳转到登录页面的问题
Browse files Browse the repository at this point in the history
Fixes #23
  • Loading branch information
Charles7c committed Oct 15, 2023
1 parent 05cb609 commit 7cf5e00
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion continew-admin-ui/src/router/guard/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function setupPageGuard(router: Router) {
}

export default function createRouteGuard(router: Router) {
setupPageGuard(router);
setupUserLoginInfoGuard(router);
setupPermissionGuard(router);
setupPageGuard(router);
}
5 changes: 5 additions & 0 deletions continew-admin-ui/src/router/guard/userLoginInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export default function setupUserLoginInfoGuard(router: Router) {
const appStore = useAppStore();
appStore.init();
if (isLogin()) {
if (to.name === 'login') {
next({ name: 'Workplace' });
NProgress.done();
return;
}
if (loginStore.roles[0]) {
next();
} else {
Expand Down

0 comments on commit 7cf5e00

Please sign in to comment.