mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-04 16:30:42 +00:00
fix: 修复刷新浏览器后页面跳转到404问题
This commit is contained in:
@@ -69,11 +69,6 @@ export const constantRoutes = [
|
|||||||
component: () => import('@/views/404'),
|
component: () => import('@/views/404'),
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: '*',
|
|
||||||
redirect: '/404',
|
|
||||||
hidden: true
|
|
||||||
},
|
|
||||||
...commonRoutes
|
...commonRoutes
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@@ -81,10 +81,16 @@ export async function generatePageRoutes({ to, from, next }) {
|
|||||||
try {
|
try {
|
||||||
// try get user profile
|
// try get user profile
|
||||||
// generate accessible routes map based on roles
|
// generate accessible routes map based on roles
|
||||||
const accessRoutes = await store.dispatch('permission/generateRoutes', { to, from })
|
let accessRoutes = await store.dispatch('permission/generateRoutes', { to, from })
|
||||||
|
|
||||||
|
// Incorrect route, jump to 404
|
||||||
|
accessRoutes = [...accessRoutes, {
|
||||||
|
path: '*',
|
||||||
|
redirect: '/404',
|
||||||
|
hidden: true
|
||||||
|
}]
|
||||||
// dynamically add accessible routes
|
// dynamically add accessible routes
|
||||||
Vue.$log.debug('All routes: ', accessRoutes)
|
Vue.$log.debug('All routes:', accessRoutes)
|
||||||
router.addRoutes(accessRoutes)
|
router.addRoutes(accessRoutes)
|
||||||
|
|
||||||
await store.dispatch('permission/generateViewRoutes', { to, from })
|
await store.dispatch('permission/generateViewRoutes', { to, from })
|
||||||
|
Reference in New Issue
Block a user