|
|
|
@ -1,39 +1,39 @@
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
|
import { navigateTo, useDark, useRoute, useRouter, useSharedFormStoreOrThrow, useTheme, watch } from "#imports"; |
|
|
|
|
import { navigateTo, useDark, useRoute, useRouter, useSharedFormStoreOrThrow, useTheme, watch } from '#imports' |
|
|
|
|
|
|
|
|
|
const { sharedViewMeta } = useSharedFormStoreOrThrow(); |
|
|
|
|
const { sharedViewMeta } = useSharedFormStoreOrThrow() |
|
|
|
|
|
|
|
|
|
const isDark = useDark(); |
|
|
|
|
const isDark = useDark() |
|
|
|
|
|
|
|
|
|
const { setTheme } = useTheme(); |
|
|
|
|
const { setTheme } = useTheme() |
|
|
|
|
|
|
|
|
|
const route = useRoute(); |
|
|
|
|
const route = useRoute() |
|
|
|
|
|
|
|
|
|
const router = useRouter(); |
|
|
|
|
const router = useRouter() |
|
|
|
|
|
|
|
|
|
watch( |
|
|
|
|
() => sharedViewMeta.value.withTheme, |
|
|
|
|
(hasTheme) => { |
|
|
|
|
if (hasTheme && sharedViewMeta.value.theme) setTheme(sharedViewMeta.value.theme); |
|
|
|
|
if (hasTheme && sharedViewMeta.value.theme) setTheme(sharedViewMeta.value.theme) |
|
|
|
|
}, |
|
|
|
|
{ immediate: true } |
|
|
|
|
); |
|
|
|
|
{ immediate: true }, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
const onClick = () => { |
|
|
|
|
isDark.value = !isDark.value; |
|
|
|
|
}; |
|
|
|
|
isDark.value = !isDark.value |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const shouldRedirect = (to: string) => { |
|
|
|
|
if (sharedViewMeta.value.surveyMode) { |
|
|
|
|
if (!to.includes("survey")) navigateTo(`/nc/form/${route.params.viewId}/survey`); |
|
|
|
|
if (!to.includes('survey')) navigateTo(`/nc/form/${route.params.viewId}/survey`) |
|
|
|
|
} else { |
|
|
|
|
if (to.includes("survey")) navigateTo(`/nc/form/${route.params.viewId}`); |
|
|
|
|
if (to.includes('survey')) navigateTo(`/nc/form/${route.params.viewId}`) |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
shouldRedirect(route.name as string); |
|
|
|
|
shouldRedirect(route.name as string) |
|
|
|
|
|
|
|
|
|
router.afterEach((to) => shouldRedirect(to.name as string)); |
|
|
|
|
router.afterEach((to) => shouldRedirect(to.name as string)) |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
|