chore: add env var to use `createWebHashHistory`

This commit is contained in:
WofWca 2023-03-27 15:11:40 +04:00
parent 0fd44e9484
commit 28b2f1aa62
2 changed files with 6 additions and 3 deletions

View File

@ -10,4 +10,5 @@
# SENTRY_AUTH_TOKEN=YOUR_TOKEN
# SENTRY_ORG=vikunja
# SENTRY_PROJECT=frontend-oss
# VIKUNJA_FRONTEND_BASE=/custom-subpath
# VIKUNJA_FRONTEND_BASE=/custom-subpath
# VITE_ROUTER_HISTORY_MODE_IS_HASH=false

View File

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