refactor
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user