Update router.ts

useRouter should fallback to useRouter from vue-router, as that will be cases where it is not defined
This commit is contained in:
Chakir QATAB 2023-08-21 17:30:20 +04:00 committed by GitHub
parent 7b35a1fe4f
commit e09b52088a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,7 +13,7 @@ import type { PageMeta } from '#app'
import { PageRouteSymbol } from '#app/components/injections'
export const useRouter: typeof _useRouter = () => {
return useNuxtApp()?.$router as Router
return useNuxtApp()?.$router ?? _useRouter() as Router
}
export const useRoute: typeof _useRoute = () => {