From f80c5aef8fb221cf14ee6ffa3ae39fd449b6b4cc Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Tue, 5 Nov 2024 12:19:06 +0100 Subject: [PATCH] feat: router hot update --- frontend/src/router/index.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 7a553e2e5..3afdf2525 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -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