mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 23:32:38 +00:00
fix(nuxt): guard window
access
This commit is contained in:
parent
54f5b9e8a4
commit
d874726ffb
@ -29,7 +29,9 @@ export default defineNuxtRouteMiddleware(async (to) => {
|
||||
// We pretend to have navigated to the invalid route so
|
||||
// that the user can return to the previous page with
|
||||
// the back button.
|
||||
window?.history.pushState({}, '', to.fullPath)
|
||||
if (typeof window !== 'undefined') {
|
||||
window.history.pushState({}, '', to.fullPath)
|
||||
}
|
||||
})
|
||||
// We stop the navigation immediately before it resolves
|
||||
// if there is no other route matching it.
|
||||
|
Loading…
Reference in New Issue
Block a user