fix: ensure router composable initialized before async

This commit is contained in:
Tim
2025-08-08 13:56:56 +08:00
parent 44c3091951
commit e1a1bc8a69

View File

@@ -127,6 +127,9 @@ export default {
}
},
async setup(props, { emit }) {
// `useRouter` must be called before any `await` to retain Nuxt instance
const router = useRouter()
const categories = ref([])
const tags = ref([])
const categoryOpen = ref(true)
@@ -190,8 +193,6 @@ export default {
watch(() => authState.loggedIn, updateCount)
})
const router = useRouter()
const handleHomeClick = () => {
router.push('/').then(() => {
window.location.reload()