This commit is contained in:
@@ -15,11 +15,13 @@ import NavBar from '@/components/NavBar.vue'
|
||||
import TimeWindows from '@/components/TimeWindows.vue'
|
||||
import Chart from '@/components/Chart.vue'
|
||||
import { windows } from '@/utils/helpers'
|
||||
import type { Window, NavType } from '@/utils/types'
|
||||
import type { Window, NavTypes } from '@/utils/types'
|
||||
import { navTypes } from '@/utils/types'
|
||||
|
||||
const defaultWindow = windows[1]
|
||||
const defaultType = navTypes[0]
|
||||
|
||||
const activeType = ref<NavType>()
|
||||
const activeType = ref<NavTypes>()
|
||||
const activeWindow = ref<Window>(defaultWindow)
|
||||
|
||||
const router = useRouter()
|
||||
@@ -27,9 +29,10 @@ const route = useRoute()
|
||||
|
||||
const urlEncodeWindow = (label: string) => label.replace(' ', '-')
|
||||
|
||||
if (route.params.type) activeType.value = route.params.type as NavType
|
||||
if (route.params.type)
|
||||
// activeType.value = (navTypes.includes(route.params.type.toString()) ? route.params.type : navTypes[0]) as NavTypes
|
||||
activeType.value = (navTypes.find((t) => t === route.params.type) || defaultType) as NavTypes
|
||||
if (route.params.window) {
|
||||
console.log(route.params.window, windows)
|
||||
activeWindow.value = windows.find((w) => urlEncodeWindow(w.label) === route.params.window) || defaultWindow
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user