This commit is contained in:
2023-02-09 23:28:26 +01:00
parent bd15f631f9
commit 4b9f533691
6 changed files with 53 additions and 32 deletions

View File

@@ -16,17 +16,18 @@ import TimeWindows from '@/components/TimeWindows.vue'
import Chart from '@/components/Chart.vue'
import { windows } from '@/utils/helpers'
import type { Window } from '@/utils/types'
import type { navType } from '@/utils/types'
const defaultWindow = windows[1]
const activeType = ref<string>('')
const activeType = ref<navType | null>(null)
const activeWindow = ref<Window>(defaultWindow)
const router = useRouter()
const currentRoute = useRoute()
if (currentRoute.params.type) activeType.value = currentRoute.params.type as string
if (currentRoute.params.window) {
activeWindow.value = windows.find((w) => w.label === currentRoute.params.window) || defaultWindow
const route = useRoute()
if (route.params.type) activeType.value = route.params.type as navType
if (route.params.window) {
activeWindow.value = windows.find((w) => w.label === route.params.window) || defaultWindow
}
const updateRoute = () => {
@@ -42,7 +43,7 @@ const updateRoute = () => {
}
}
const setType = (newType: string) => {
const setType = (newType: navType) => {
activeType.value = newType
updateRoute()
}