feat: router hot update

This commit is contained in:
Dominik Pschenitschni 2024-11-05 12:19:06 +01:00
parent e074e5ae47
commit f80c5aef8f
1 changed files with 9 additions and 2 deletions

View File

@ -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