修复前端登录权限边界问题
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user