fix: Keep existing links working

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2023-11-11 23:07:16 +01:00
parent 9f98f0bd5f
commit 7127f88318

View File

@@ -33,7 +33,7 @@ import Overview from './components/overview/Overview.vue'
Vue.use(Router)
export default new Router({
const router = new Router({
mode: 'history',
base: generateUrl('/apps/deck/'),
linkActiveClass: 'active',
@@ -158,3 +158,15 @@ export default new Router({
},
],
})
router.beforeEach((to, from, next) => {
// Redirect if fullPath begins with a hash (ignore hashes later in path)
if (to.fullPath.substring(0, 2) === '/#') {
const path = to.fullPath.substring(2)
next(path)
return
}
next()
})
export default router