修复前端登录权限边界问题

This commit is contained in:
andy
2026-07-10 09:35:47 +08:00
parent e49b2ccc1d
commit 25efcccf72
11 changed files with 282 additions and 15 deletions

View File

@@ -15,9 +15,10 @@ export const router = createRouter({
routes: [
{
path: '/',
redirect: () => {
const authStore = useAuthStore()
return authStore.firstMenuPath ?? '/reservation/orders'
name: 'home',
component: {
name: 'HomeRedirectView',
render: () => null,
},
},
{
@@ -126,6 +127,10 @@ export function createAuthGuard(resolveAuthStore: () => AuthStore = () => useAut
}
}
if (to.path === '/') {
return authStore.firstMenuPath ?? '/reservation/orders'
}
if (meta.permission && !authStore.hasPermission(meta.permission)) {
return {
name: 'unauthorized',