feat: router hot update
This commit is contained in:
parent
e074e5ae47
commit
f80c5aef8f
|
|
@ -1,5 +1,6 @@
|
|||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import type { RouteLocation } from 'vue-router'
|
||||
import { createRouter, createWebHistory, type RouteLocation } from 'vue-router'
|
||||
import { routes, handleHotUpdate } from 'vue-router/auto-routes'
|
||||
|
||||
import {saveLastVisited} from '@/helpers/saveLastVisited'
|
||||
|
||||
import {getProjectViewId} from '@/helpers/projectView'
|
||||
|
|
@ -32,6 +33,7 @@ const router = createRouter({
|
|||
return {left: 0, top: 0}
|
||||
},
|
||||
routes: [
|
||||
...routes,
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
|
|
@ -386,6 +388,11 @@ const router = createRouter({
|
|||
],
|
||||
})
|
||||
|
||||
// Update routes at runtime without reloading the page
|
||||
if (import.meta.hot) {
|
||||
handleHotUpdate(router)
|
||||
}
|
||||
|
||||
export async function getAuthForRoute(to: RouteLocation, authStore) {
|
||||
if (authStore.authUser || authStore.authLinkShare) {
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in New Issue