mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-31 06:34:13 +00:00
fix: 修复刷新浏览器后页面跳转到404问题
This commit is contained in:
@@ -69,11 +69,6 @@ export const constantRoutes = [
|
||||
component: () => import('@/views/404'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '*',
|
||||
redirect: '/404',
|
||||
hidden: true
|
||||
},
|
||||
...commonRoutes
|
||||
]
|
||||
|
||||
|
@@ -81,10 +81,16 @@ export async function generatePageRoutes({ to, from, next }) {
|
||||
try {
|
||||
// try get user profile
|
||||
// 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
|
||||
Vue.$log.debug('All routes: ', accessRoutes)
|
||||
Vue.$log.debug('All routes:', accessRoutes)
|
||||
router.addRoutes(accessRoutes)
|
||||
|
||||
await store.dispatch('permission/generateViewRoutes', { to, from })
|
||||
|
Reference in New Issue
Block a user