From 28b2f1aa621ccdff20929e998cf7b848c7655d27 Mon Sep 17 00:00:00 2001 From: WofWca Date: Mon, 27 Mar 2023 15:11:40 +0400 Subject: [PATCH] chore: add env var to use `createWebHashHistory` --- .env.local.example | 3 ++- src/router/index.ts | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.env.local.example b/.env.local.example index 9c7389158f..663423eb0e 100644 --- a/.env.local.example +++ b/.env.local.example @@ -10,4 +10,5 @@ # SENTRY_AUTH_TOKEN=YOUR_TOKEN # SENTRY_ORG=vikunja # SENTRY_PROJECT=frontend-oss -# VIKUNJA_FRONTEND_BASE=/custom-subpath \ No newline at end of file +# VIKUNJA_FRONTEND_BASE=/custom-subpath +# VITE_ROUTER_HISTORY_MODE_IS_HASH=false diff --git a/src/router/index.ts b/src/router/index.ts index 542ec3249a..c73848528a 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,4 +1,4 @@ -import { createRouter, createWebHistory } from 'vue-router' +import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router' import type { RouteLocation } from 'vue-router' import {saveLastVisited} from '@/helpers/saveLastVisited' @@ -81,7 +81,9 @@ const EditTeamComponent = () => import('@/views/teams/EditTeam.vue') const NewTeamComponent = () => import('@/views/teams/NewTeam.vue') const router = createRouter({ - history: createWebHistory(import.meta.env.BASE_URL), + history: import.meta.env.VITE_ROUTER_HISTORY_MODE_IS_HASH === 'true' + ? createWebHashHistory(import.meta.env.BASE_URL) + : createWebHistory(import.meta.env.BASE_URL), scrollBehavior(to, from, savedPosition) { // If the user is using their forward/backward keys to navigate, we want to restore the scroll view if (savedPosition) {